• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 442
  • Last Modified:

How do I track two GA accounts on a website?

I need to track all pages of a website for two separate GA accounts. The parent company wants to allow a partner to track the traffic but does not want them to have access to their Google Analytics Account.

Could someone please provide the correct code? I've seen examples but these seem to relate to cases where different sections needed to be tracked. All pages on the website concerned would have the same code.

Many thanks for any assistance provided
0
yorkshireladdie
Asked:
yorkshireladdie
  • 4
  • 2
  • 2
1 Solution
 
David H.H.LeeCommented:
Hi yorkshireladdie,
You only need to grant to user permission in google analytic account to access your analytic reports.
Check this for more details how to configure it instead of working the analytic code:
http://www.google.com/support/analytics/bin/answer.py?answer=55500
0
 
yorkshireladdieAuthor Commented:
Thank you for your reply but I now have more background which paints a clearer picture of the problem.

The partner already has their own GA account and is historically tracking the data from the website concerned. The parent now want to track the data on their own GA account but don't want to go back to the partner - which I can understand. Hence the need to be able to track data on two GA accounts.

I appreciate your help and would be obliged for any assistance you can provide
0
 
David H.H.LeeCommented:
yorkshireladdie,
I'm try to figure out if we are in the mutual understanding in solving this problem:

Original question post:
>>..The parent company wants to allow a partner to track the traffic but does not want them to have access to their Google Analytics Account.

Follow up your current environment:
>>..The partner already has their own GA account and is historically tracking the data from the website concerned.
The parent now want to track the data on their own GA account but don't want to go back to the partner
Does the new created GA Account in partner affect the latest GAresult? Do you still want to use same profile or creating new profile to refer the latest GA traffic, obsoleted the previous GA traffic?  You need to choose which GA to run in this case...

>> Hence the need to be able to track data on two GA accounts.
Generally, it is advisable to use same google profile to refer the GA result. In this case, you only need to grant the view traffic permission to specific GA Account as guided in my previous post.
Otherwise, you need to obsolete the previous GA traffic if your partner is referring new GA traffic using new GA Account instead of view GA via granted permission to access old GA details.
However, you can track multiple GA account under same web site, but you have to refer GA code separately into different landing page. This is depending how you control the strategy of your GA and the way you monitor the traffic as planned.
0
Meet the Family that is Made for Collaboration

The TeamConnect Family product group as part of the Sennheiser for Business Portfolio comprising high-quality, technically well-conceived meeting solutions for business communication – designed for any meeting room and any meeting situation.

 
yorkshireladdieAuthor Commented:
Thank you very much for your reply and the points you have raised. I need to point out that the relationship between the two organisations is a trading one on this project only. There are no formal links between the two organisations.

For a number of reasons the Parent company do not want to go back to the Partner at this stage and ask them to

a) Cancel their existing tracking which is already set up and working on the partners GA account
b) Ask the Partner to give the Parent access to their GA account.

That is a situation which I cannot change.

It has been suggested that I can use this code below o achieve the objective. I appreciate this is not necessarily best practice but I need a workaround. Can you please advise whether the following script would work

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
  _gaq.push(['_setDomainName', '.examplesite.eu']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_setAccount', 'UA-XXXXXXX-28']);
  _gaq.push(['_setDomainName', '.examplesite.eu']);
  _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>

Many thanks for your kind assistance

0
 
Tony McCreathTechnical SEO ConsultantCommented:
That won't work as you will override settings.

Try something like this:


<script type="text/javascript">

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

 // Second tracker 
	_gaq.push(['secondTracker._setAccount','UA-YYYYYYYY-Y']); 
	_gaq.push(['secondTracker._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
 
yorkshireladdieAuthor Commented:
Thanks very much for your assistance Tiggerito and your suggested script that's great.

Can you just confirm what you mean by overwrite settings? Do you mean the settings that are already established on an original account or something else?

Many thanks again for your help, its really appreciated.

0
 
Tony McCreathTechnical SEO ConsultantCommented:
I'm not fully clear in this myself, so this explanation may be wrong:

In both versions of the code we are creating a series of commands that get put on a queue for later execution, once the page is loaded.

In your example you are placing two commands in exactly the same place, which means the second _setAccount will overwrite the command made for the first _setAccount. With this you run the risk that the function of the first account you are tracking gets mixed up with settings from the second account and it does not track properly.

In my example the second set of commands are added in a special namespace (secondTracker) which means the are somewhere else and don't directly interfere with the first commands.

Something like that anyhow ;-)



0
 
yorkshireladdieAuthor Commented:
Absolutely brilliant - thanks very much that works perfectly.

Sorry for the delay in awarding the points but I was away for the weekend.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now