Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have set up two different profiles in my Google analytics account for my website. The reason for having two different profiles is that my site is completely divided in two different user groups (not sharing anything (buyers and sellers)).

When reading the documentation on profiles and accounts from google it says that each profile as subid UA-XXXX-1, UA-XXXX-2 etc... My tracking code just uses -1 and therefore both profiles show the same information. I can't figure out how my tracking code should differ between the two. In my mind it should be:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXX-1']);
_gaq.push(['_setDomainName', 'mysite.com']);
_gaq.push(['_setAllowHash', false]);
_gaq.push(['_trackPageview']);
... analytics javascript.
</script>

And on the second part of the site it should be:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXX-2']);
_gaq.push(['_setDomainName', 'mysite.com']);
_gaq.push(['_setAllowHash', false]);
_gaq.push(['_trackPageview']);
... analytics javascript.
</script>

I can't see any examples and my profiles show the same tracking code in analytics. I'm lost in how to make the two different profiles gathering the information separatly.

My question is simple: How do I alter my tracking code so that traffic gets logged either in my default profile or second profile? Is there something that I'm missing?

Super thanks for any answer to this.

Best regards,

Niclas

share|improve this question

migrated from stackoverflow.com Sep 12 '11 at 11:35

This question came from our site for professional and enthusiast programmers.

    
did you set up 1 domain with 2 profiles? or did you add 2 domains? –  mars Sep 12 '11 at 8:08

1 Answer 1

Whenever you're changing the website profile number (the # in UA-XXXXXXXX-#), you need to make sure you're adding a new website profile in GA. Once you do this, you will see a new section for that site in GA.

Multiple website profiles look something like this and a single website with multiple profiles looks something like this.

In a case like this, I'd suggest going with a single website profile, but have multiple profiles within that (like the second screenshot shows). For this, you'd need at least 3 different sub-profiles:

  1. Master roll-up with unfiltered data
  2. A profile for your buyers
  3. A profile for your sellers

Now, the real question is how do you segment this traffic? Is it via different URLs or via just server-side logic? Both ways you can filter out the traffic via a Filter in GA for that profile. You can read more about filters in GA on their support site. You'd most likely need to use an custom advanced filter that either checks for a certain subdomain/subdirectory or checks against custom variables that you would need to pass for member type.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.