Tracking Outbound Links with Google Analytics

Posted by Sheldon Finlay on December 18, 2009

I recently set up some social media links on a site and wanted to be able to track the clicks to each one. These were a couple of graphics that linked to a Twitter page and a Facebook fan page. The site uses Google Analytics to keep track of web statistics, and I wanted to be able to track the clicks to these two graphics. However Google Analytics doesn’t automatically track outbound links. Fortunately Google Analytics does have a little bit of JavaScript that you can append on to a link which will add outbound tracking to your Analytic Contents reports. Here’s the full image/link code for the two graphics:

<a onclick="javascript: pageTracker._trackPageview('/outgoing/twitter');" href="http://twitter.com/myaccount/" target="_blank"><img src="images/extras/social/rightnav/rightnav-twitter.gif" alt="Follow us on Twitter!" width="292" height="70" /></a></code>

<a onclick="javascript: pageTracker._trackPageview('/outgoing/facebook');" href="http://www.facebook.com/pages/myaccount/174805948058" target="_blank"><img src="images/extras/social/rightnav/rightnav-facebook.gif" alt="Join our Facebook fan page!&lt;/code&gt;" width="292" height="61" /></a>

Now the important thing here is the onclick event. You want to specify a unique made-up page name. This can also be a directory, like in my example. The actual name or directory doesn’t need to exist. In fact it probably shouldn’t exist, since you don’t want it conflicting with an actual URL on your site.

For my purposes I track all outgoing links by prefixing them with /outgoing/. So to track the Twitter link I set the to _trackPageView(’/outgoing/twitter’). This is so I can filter by ‘outgoing’ and see a report of all outbound traffic.

Now after you’ve had this in place for a day or two you can log into Google Analytics, go to the Top Content report and then filter by whatever your _TrackPageView is set to. In my example, I’d filter by ‘outbound’ and it would return a nice report of all my tracked outbound links. One could even set up a nice custom report to save themselves the steps of having to filter your content report.

Now this solution works for a few links, but wouldn’t be ideal if you wanted to track a large number of links. You could, in theory, cook something up in jQuery or straight-up JavaScript to automatically add in the onclick event to all your outbound links. I am sure something already exists that would handle this.

There is a helpful support page on the topic of manually tracking outbound links available from Google.

MobileMe iDisk Not in Sync 2

Posted by Sheldon Finlay on December 17, 2009

mobilemeI love MobileMe. It complements my workflow in countless ways. I particularly like using the iDisk to sync a selection of files between multiple computers. It’s nice to be able to work on a file during the day on one computer and come home and work on it on another computer without having to copy the file. However, every once in a while it hits a snag and no matter how many times I attempt to manually sync, the files just don’t update and I see a message in the bottom of the finder that says “iDisk not in sync”. So what now? We’ll it’s quite easy to get back up and running. You just need to follow these steps:

  1. Go to MobileMe under System Preferences.
  2. Under the iDisk Tab click “Stop” to disable iDisk syncing. This will create a local copy of your files on your desktop called “previous local idisk”.
  3. Next, go to the Account tab and click Sign Out.
  4. Now sign back In with an incorrect username and password. Anything will do. You should get an error message.
  5. Next, sign back into your Mobile Account with your correct username/password.
  6. Go back to the iDisk tab and Turn On iDisk Syncing.
  7. Now the iDisk icon should be back on your desktop. If you open it, it should start showing that it’s syncing. It may take a while depending upon how many files you have on your iDisk.
  8. Finally, you may have to manually put any recently updated or created files from your “previous local idisk” into your iDisk.

And that should be it. You might need to repeat this process on any computer that you sync to your iDisk which is having problems syncing.