Google Analytics Social Tracking implementation. Is Google's example correct?
Posted
by
s_a
on Pro Webmasters
See other posts from Pro Webmasters
or by s_a
Published on 2013-07-16T15:24:46Z
Indexed on
2013/10/23
22:07 UTC
Read the original article
Hit count: 230
The current Google Analytics help page on Social tracking (developers.google.com/analytics/devguides/collection/gajs/gaTrackingSocial?hl=es-419) links to this page with an example of the implementation: http://analytics-api-samples.googlecode.com/svn/trunk/src/tracking/javascript/v5/social/facebook_js_async.html
I've followed the example carefully yet social interactions are not registered. This is the webpage with the non-working setup: http://bit.ly/1dA00dY (obscured domain as per Google's Webmaster Central recommendations for their product forums)
This is the structure of the page:
- In the :
- ga async code copied from the analytics' page
- a script tag linking to stored in the same domain.
- the twitter js loading tag
- In the
- the fb-root div
- the facebook async loading js including the _ga.trackFacebook(); call
- the social buttons afterwards, like so:
- (with the proper URL)
- Tweet (with the proper handle)
That's it. As far as I can tell, I have implemented it exactly like in the example, but likes and twitts aren't registered.
I have also altered the ga_social_tracking.js to register the social interactions as events, adding the code below. It doesn't work either. What could be wrong?
Thanks!
Code added to ga_social_tracking.js
var url = document.URL;
var category = 'Social Media';
/* Facebook */
FB.Event.subscribe('edge.create', function(href, widget) {
_gaq.push(['_trackEvent', category, 'Facebook', url]);
});
/* Twitter */
twttr.events.bind('tweet', function(event) {
_gaq.push(['_trackEvent', category, 'Twitter', url]);
});
© Pro Webmasters or respective owner