jaredatch / Shared-Counts

WordPress plugin that leverages SharedCount.com API to quickly retrieve, cache, and display various social sharing counts.
GNU General Public License v2.0
47 stars 16 forks source link

Native Facebook query not returning counts #96

Closed billerickson closed 4 years ago

billerickson commented 4 years ago

This was first reported by Jon Brown. I've actually had similar reports from clients but assumed they were being rate-limited by Facebook and had them switch to SharedCount.com.

Our current GET request to Facebook only returns the object id (url), not the share counts.

When I run this code (pulled from Shared Counts plugin), here's the response from Facebook:

screenshot

Adding 'fields' => 'og_object{engagement}' to the $args (full code here) returns the following:

screenshot

Engagement appears to be the sum total of shares, comments, and reactions. I get the same number from SharedCount.com:

screenshot

I'm not sure how to get the individual components though. Wondering if we should just update total_count if using the native source.

jb510 commented 4 years ago

Thanks Bill. I couldn't for the life of me figure out FB's syntax. I presumed {} and og_object were placeholders, oops

It might also make sense at this time to update the call to include the API version number, to avoid unexpected breakage in the future, no? I'll test that code.

https://developers.facebook.com/docs/graph-api/reference/v6.0/url

NormanHoehne commented 4 years ago

I've made a pull request #98 to face this issue

On https://developers.facebook.com/docs/graph-api/reference/v7.0/url there is an example response for the engagement on the supplied url. I tested different version numbers (beginning from 2.9) within the request url as @jb510 recommended but the requests and the responses did not differ from each other. That's why I did not included it in the pull request.

billerickson commented 4 years ago

This has been fixed in b230d16df308ed812c715535fecb64de8c635779