Google Analytics Tracking with Multiple Profiles

Last modified on:

If you want to track multiple profiles, within your own account, or over different accounts, you need to call the google tracking code twice within your javascript code.

You need to change the second part of the Google Analytics javascript tracking code that you attach to the foot of every page:

try {
var pageTracker = _gat._getTracker(“UA-530705-5”);
pageTracker._trackEvent();
pageTracker._trackPageview();
var secondTracker = _gat._getTracker(“UA-1319834-20”);
secondTracker._trackEvent();
secondTracker._trackPageview();
} catch(err) {}

Notice that I have also inserted the Event tracking code too – this needs to be called before the trackPageview code and your onClick handler must call every instance of the trackEvent code for events to be tracked in both accounts / profiles. This does add a bit of repetition in your code, but I can’t see an alternative at the moment.

This is useful for collecting data in your own account and, say an agencies account – if you ever ditch the agency, then you still have all your data in your own account.


Published on

in

by

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *