Accessing Google +1 stats via Google Analytics API?
I found this blog post about accessing Google +1 stats. However, we are rolling out a fairly large project that needs to incorporate the functionality of a +1 button (even if we don't use Google), and I was hoping there was some way to access these metrics through a more officially supported API. Since you seem to be able to integrate the +1 button and Google Analytics I was hoping this might be a mor开发者_JS百科e stable way to gain access to the +1 button stats. Does anyone know if this is possible?
The second article you're referencing explains how to use a callback function to record someone clicking on the +1 Button in Google Analytics. It's using event tracking so you should be able to pull the ga:eventAction
dimension and ga:totalEvents
metric from the Data Export API (see http://code.google.com/apis/analytics/docs/gdata/gdataDeveloperGuide.html). The current number of +1's for a site should be the total events where the event action was set to 'on' minus the total events where the event action was set to 'off'.
You'll need to add a filter to the extract so it only pulls out events with the ga:eventCategory
of 'plusone'. You will probably also want to add the ga:pagePath
dimension so you can split the results by page instead of the whole site.
One thing to note is that the results might not match up perfectly with what's recorded on the site. If the site has already received some +1 votes before the event tracking is implemented then they will be missing from your count. Also, tracking is never perfect so some button clicks will occasionally be missed.
精彩评论