Solved

Google Analytics - Two Seperate Tracking Urchins?

Posted on 2010-11-27
4
283 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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Obtaining data on ASP 8 36
Set time on Session (ASP) 14 30
Date on a table 16 35
output in HTML in Powershell 5 26
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
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).

749 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