title: Social tracking in Google Analytics
body: <p>I'm using this example script, provided by Google inside a rails app (so it's compiled by Rails into a single JS file with all my other scripts):</p>
  
  <pre><code>_ga.trackSocial = function(opt_pageUrl, opt_trackerName) {
    _ga.trackFacebook(opt_pageUrl, opt_trackerName);
    _ga.trackTwitter(opt_pageUrl, opt_trackerName);
  };
  
  
  /**
   * Tracks Facebook likes, unlikes and sends by suscribing to the Facebook
   * JSAPI event model. Note: This will not track facebook buttons using the
   * iFrame method.
   * @param {string} opt_pageUrl An optional URL to associate the social
   *     tracking with a particular page.
   * @param {string} opt_trackerName An optional name for the tracker object.
   */
  _ga.trackFacebook = function(opt_pageUrl, opt_trackerName) {
    var trackerName = _ga.buildTrackerName_(opt_trackerName);
    try {
      if (FB &amp;&amp; FB.Event &amp;&amp; FB.Event.subscribe) {
        FB.Event.subscribe('edge.create', function(targetUrl) {
          _gaq.push([trackerName + '_trackSocial', 'facebook', 'like',
              targetUrl, opt_pageUrl]);
        });
        FB.Event.subscribe('edge.remove', function(targetUrl) {
          _gaq.push([trackerName + '_trackSocial', 'facebook', 'unlike',
              targetUrl, opt_pageUrl]);
        });
        FB.Event.subscribe('message.send', function(targetUrl) {
          _gaq.push([trackerName + '_trackSocial', 'facebook', 'send',
              targetUrl, opt_pageUrl]);
        });
      }
    } catch (e) {}
  };
  </code></pre>
  
  <p>Then, this code to load my Facebook like button:</p>
  
  <pre><code>&lt;div id="fb-root" class="fb_like"&gt;&lt;/div&gt;
  &lt;script src="http://connect.facebook.net/en_US/all.js#appId=...&amp;amp;xfbml=1"&gt;&lt;/script&gt;
  &lt;fb:like href="http://somethingunderthewater.com" send="true" layout="standard" colorscheme="light" width="400" show_faces="false" font="trebuchet ms"&gt;&lt;/fb:like&gt;
  </code></pre>
  
  <p>But while Google tracks the +1 button, it's not tracking any Facebook like events and I really don't know enough about JS to figure out what's wrong. I see the note about the iFrame method, but don't think that's how my code is loading -- maybe I'm wrong?</p>