Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Analytics code, 2 tracking codes on 1 domain

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch

oberheimer

Established Member
Impact
51
I have 1 host and i have linked two domains to the same directory on my host

.se and .co
Now i want to track the domain individually on analytics

Here is the code i have used, but is it right?

<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">
try {
var pageTracker1 = _gat._getTracker("[UA-00000000-1]");
pageTracker._trackPageview();
} catch(err) {}
try {
var pageTracker2 = _gat._getTracker("[UA-00000000-0]");
pageTracker2._trackPageview();
} catch(err) {}
</script>

I have aded this filter to only include the hostname www\.domain\.se and then one for the .co
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Insert different javascript code according to domain name on the server side. I think it's better. If php is used for server side scripts so not any problem to use condition
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back