• Resolved treeflips

    (@treeflips)


    Hey guys, I love what you’re doing and glad that you’re bringing some of Social Warfare’s features to the public for free.

    QUESTION/S:
    – I’m guessing this plugin is so fast because your servers gather all the [share counts] info and this plugin only calls one request from your server? (instead of making individual requests to each social network’s API?)
    – I saw your pricing on how many API requests a day we can make. Does one pageload equal one request? Or is it one pageload X number of networks?
    – Have more but curious how these pan out.

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    Thanks for the kind words!

    The Shared Counts plugin is not owned or operated by SharedCount.com, but we recommend using that service for the performance reasons you mention.

    First, we do not refresh the share data on every pageload. We cache the data (as post meta) and refresh it:
    – Every 30 minutes for posts published in the last 24 hours
    – Every 6 hours for posts published in the last 5 days
    – Every 5 days for posts older than that.

    You can customize how often it is updated by filtering this function.

    Once we determine a post has “stale” data and needs to be refreshed, we wait until the page is done loading to query the APIs. This ensures the page load for your users isn’t affected.

    If you’re using SharedCount.com as the data source, it does one query total for Facebook, Pinterest, and StumbleUpon. If you check “Include Twitter Counts” and/or “Include Yummly Counts”, these are each an additional query (so 3 total if all checked).

    If you check “Preserve HTTP Count” this doubles the query count since it’s duplicating those queries for the http version of the URL. So checking this will bring the total query count to 2-6 depending on whether you’re retrieving twitter and yummly counts. Of those queries, only 1 or 2 will be to SharedCount.com so count towards your API limit.

    You can use a filter to limit the HTTP lookup for posts older than a certain date (when you switched to HTTPS) so you aren’t doubling the queries for newer content.

    With the caching in place, almost every website should be able to use the free account at SharedCount. You would need about 50,000 posts to hit the API limit.

    When you first sign up for SharedCount.com they give you 1,000 queries/day. If you connect your Facebook account, they bump it to 10,000 queries/day.

    Let me know if there’s anything else I can help with.

    I noticed the code in the last line of this filter had a few typos
    https://github.com/jaredatch/Shared-Counts/wiki/Preserve-HTTP-Counts

    add_filter( ‘shared_counts_preserve_http, ‘shareds_count_maybe_preserve_http’, 10, 2 );

    should be

    add_filter( ‘shared_counts_preserve_http’, ‘shared_counts_maybe_preserve_http’, 10, 2 );

    add closing ‘
    and “shareds_count” should be “shared_counts”

    Hopefully that is correct.

    • This reply was modified 6 years, 8 months ago by Veken.
    • This reply was modified 6 years, 8 months ago by Veken.
    Plugin Contributor Jared Atchison

    (@jaredatch)

    Hey veken – thanks for the heads up, really appreciate it. Should be fixed now ??

    Thanks for the quick reply! looks like it’s still missing the closing apostraphe on the first term here:

    ‘shared_counts_preserve_http, ‘shared_counts_maybe_preserve_http’,
    should be
    ‘shared_counts_preserve_http’, ‘shared_counts_maybe_preserve_http’,

    Plugin Contributor Jared Atchison

    (@jaredatch)

    Thanks, not enough coffee this afternoon!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How many external requests?’ is closed to new replies.