Solved

Google Analytics - Two Seperate Tracking Urchins?

Posted on 2010-11-27
4
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 31

Accepted Solution

by:
James Murrell earned 250 total points
ID: 34223412
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:Tony McCreath
Tony McCreath earned 250 total points
ID: 34224000

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
ID: 34232744
Thanks Both, but neither appears to work :( any suggestions?

thank you
0
 

Author Comment

by:garethtnash
ID: 34233276
ignore me - thanks both
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

688 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