in Article 0 comments 2405

We often work on campaigns where the website was built and/or managed by another agency or the client themselves. As with most of our campaigns we like to know how the audience is responding or behaving so we like to have Google Analytics or another kind of tracking on their website. The problem sometimes is that either the site owners or admin don’t always want to allow us to see their google analytics. So we discovered a solution to help us get around this and given that it took us longer than it probably should have to discover this solution we thought we’d share it.

So here’s the normal Google Analytics script with our added tracking:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);


  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);


The important part is the additional lines in bold, these are the same as the lines above them but with an identifying name, in this example we used ‘agency.’.

Using this method you can also track events to different accounts using the standard event tracking method in Google Analytics. Again the difference is the additional line name preceeding the trackEvent

_gaq.push(['_trackEvent', 'link', 'click', 'linkClicked']);
_gaq.push(['agency._trackEvent', 'link', 'click', 'linkClicked']);

Sorry, the comment form is closed at this time.