Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Google Analytics - Two Seperate Tracking Urchins?

Posted on 2010-11-27
4
Medium Priority
?
287 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 1000 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 1000 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

Starting your own business is always a daunting process, and for most people it is brand new experience. Avoid the common pitfalls by following these tips to start on the road to success.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

604 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