Jack
Jack

Reputation: 245

Google Analytics, track same website with two different accounts, how?

as the title says, how do I track a website with Google Analystics from two different accounts?

I made some research about this topic and found alot of old posts which were saying that you should include the different tracking codes at each side. But this can't be the best way, right?

Is it possible to do something like this?

Old Code:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-1']);
_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>

New Code:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-1']);
_gaq.push(['_setAccount', 'UA-xxxxxxxx-2']);
_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>

Thanks in advance Jack

Upvotes: 0

Views: 614

Answers (2)

Jaykumar Patel
Jaykumar Patel

Reputation: 27614

Yes, its possible without updating any old code. you have to add other account to primary account:

  1. Click Admin at the top of Google Analytic page.

  2. To show three column Account, PROPERTY, VIEW.

  3. Select USER MANAGEMENT from Account, PROPERTY, VIEW base on access permission.

  4. Enter Email address and assign roll.

  5. check your secondary email address website tracking same as primary email address.

Upvotes: 1

BiscuitBaker
BiscuitBaker

Reputation: 1421

You can track the same page on two different GA accounts using this code:

var _gaq = _gaq || [];
  _gaq.push(
  ['_setAccount', 'UA-12345678-1'],   // First account
  ['_trackPageview'],
  ['b._setAccount', 'UA-87654321-1'], // Second account
  ['b._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);
})();

This has always worked for us.

Upvotes: 1

Related Questions