Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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:

  1. In the :
    1. ga async code copied from the analytics' page
    2. a script tag linking to stored in the same domain.
    3. the twitter js loading tag
  2. In the
    1. the fb-root div
    2. the facebook async loading js including the _ga.trackFacebook(); call
    3. the social buttons afterwards, like so:
      1. (with the proper URL)
      2. 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]);
});
share|improve this question

1 Answer 1

One possibility: You may be trying to bind to the events before all the javascript files are loaded. The calls to FB.Event.subscribe and twttr.events.bind should be done after the page is loaded. For example using jquery $(document).ready(function() { or the method built into the facebook api: window.fbAsyncInit = function(){

I would recommend putting console.log calls next to your _gaq.push calls to ensure that you can see those functions firing when you push the like button.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.