Solved

Google Analytics - Two Seperate Tracking Urchins?

Posted on 2010-11-27
4
278 Views
Last Modified: 2013-11-18
Hello,

I run a group of sites, each of which currently is attached to a Google Analytics account for per site tracking. There are 76 sites in total.

Now because of my business model, it is also really important to track the group, as a group, rather than have 76 different reports to collate data from.

So each site currently has something like this within each pages code -

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-19999999-99]);
  _gaq.push(['_trackPageview']);

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

</script>

Can I add to this with another group code like so

[First site specific google code]
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-19999999-99]);
  _gaq.push(['_trackPageview']);

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

</script>
[Second Group Specific Code]
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-19999999-66]);
  _gaq.push(['_trackPageview']);

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

</script>

I'm more than happy on the group one to track (inter-group) traffic from one site within the group to another, so don't need to discount this....

Really grateful for any thoughts suggestions regarding this, please.

Thanks Experts
0
Comment
Question by:garethtnash
  • 2
4 Comments
 
LVL 31

Accepted Solution

by:
James Murrell earned 250 total points
Comment Utility
hello this is a must read for you http://www.optimiced.com/en/2007/10/25/two-or-more-google-analytics-in-one-page/

not easy but it can work
0
 
LVL 23

Assisted Solution

by:Tiggerito
Tiggerito earned 250 total points
Comment Utility

This code should work.

Note that the second two tracker lines have a different account and the commands are prefixed with an account name (second.)
<script type="text/javascript">



  var _gaq = _gaq || [];



  // first

  _gaq.push(['_setAccount', 'UA-19999999-01]);

  _gaq.push(['_trackPageview']);



  // second

  _gaq.push(['second._setAccount', 'UA-19999999-99]);

  _gaq.push(['second._trackPageview']);



  (function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

  })();



</script>

Open in new window

0
 

Author Comment

by:garethtnash
Comment Utility
Thanks Both, but neither appears to work :( any suggestions?

thank you
0
 

Author Comment

by:garethtnash
Comment Utility
ignore me - thanks both
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Digital marketing agencies have encountered both the opportunities and difficulties that emerge from working with a wide-ranging organizations.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now