Forum Moderators: DixonJones

Message Too Old, No Replies

Two Google Analytics Code on one page

         

pmgreen

6:47 pm on Jan 13, 2009 (gmt 0)

10+ Year Member



Is it possible to have two GA codes on one page. Another words, we have a profile for the Intranet as a hole and than broken out into a specific section.

BradleyT

10:23 pm on Jan 13, 2009 (gmt 0)

10+ Year Member



Here's an alternative.

Create a new profile named after the section.
Create a filter using "Include only traffic to a subdirectory".
The filter would be something like ^/shop/ if I wanted to track shopping pages.
Apply the filter to the profile you created.

Now when you view the profile it only has shopping traffic.

phranque

2:55 am on Jan 14, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



yes you can have multiple analytics codes per page.
just set it up so each one makes the proper request when the page loads.
put it just before the closing body tag so it doesn't slow down page rendering.

pmgreen

2:30 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



I tried using this code, but only the first one was activated. Greatly appreciate any help

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://
ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-
analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var firstTracker = _gat._getTracker("UA-745787-9");
firstTracker._initData();
firstTracker._trackPageview();
var secondTracker = _gat._getTracker("UA-745787-25");
secondTracker._initData();
secondTracker._trackPageview();
</script>

BradleyT

6:32 pm on Jan 14, 2009 (gmt 0)

10+ Year Member



Did you give my alternative method a try? It only takes about 2 minutes to set up in GA, doesn't require you add any code to the site and does exactly what you're asking.

blazebianca

3:25 am on Jan 23, 2009 (gmt 0)

10+ Year Member



i have two G. Analytics code in my website and its working fine. after a month of installing the two codes, my visitors and unique visitors went up dramatically while my pageviews went down. Well, we had a major website revamp that time too so i guess that contributed a lot to the number visitors.

i knew about the filter option all along but haven't given it a try. i think its time that i should. its a lot easier and more reliable, ryt? =)

thanks!