Monday, January 24, 2011

How to install Google Analytics to Tumblr

This is something that comes up often on the Google Analytics Help Forum

Unfortunately the Tumblr help docs for installing Google Analytics are showing a somewhat very out of date version of tracking code (note the image that appears to show part of the 'old' urchin.js - meaning the help doc hasn't been updated for a while!) ... and Tumblr.com for some reason doesn't seem to like the current asynchronous version of the GA code, which got me thinking on how to go about it ...

At this point in time, my suggested method seems to work without problem


We'll go the route of creating a new profile for a new domain for this example

Select Add a new profile
Add a new google analytics profile

Check the radio button Add profile for a new domain and enter your tumblr url address and adjust the Country and timezone settings to your location as need be.
Create the profile for a new domain

On the page that comes up with your ga tracking code ...
Select the Custom tab and enter in a copy of the traditional version of the ga tracking code:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}
</script>

Add a new google analytics profile

Insert your web property ID (UA number) as shown in the upper yellow section where it says Tracking Status Information into the applicable part of the code.

Copy and paste this edited tracking code into notepad or some other text editor to keep it handy for a moment.

Click Save and Finish in GA. It will use this custom version of the tracking code for tracking.

Go to your tumblr account and select the dashboard and then customize (on the right)
Create the profile for a new domain

Click on the Info tab at the upper left and enter the edited traditional tracking code that you copy and pasted into notepad.. click save and close on the upper right
Where to enter your custom tracking in tumblr description box

Give it up to 24 hours (in this instance it took around 10mins) and you should now see the icon that indicates the installed tracking code has been found and is waiting for data
GA shows code has been successfully found


and over the next 4-24 hours this should change to a green tick and your reporting profile should start to show visitor data
GA begins to track tumblr.com visitor data