Hi I've been struggling with a site having 2 domain extensions (parked domain: .com and .co.za) for a while now. I wonder if the analytics on the site is tracking traffic from only 1 of the domains, so I tested it. I created 2 analytics tracking codes and added both to that 1 page. I see different stats for the same page, accessed from .com and .co.za domain. Is that possible? The owner doesn't want to spend money hosting the .com, just to redirect it to the .co.za. I've posted a thread earlier on the .htaccess issues, while looking for a solution. Any help much appreciated.
Having 2 codes on one page just means all your data is doubled. It's pointless, messy and you can't believe any of the metrics.
Thanks for your reply Magda. But how would you explain the fact that there is different data for the same period? Even though the data trends are very similar, it's not an exact match (10% difference)?
Putting 2 lots of analytics codes onto the site is likely to produce some odd results since it's being run twice and potentially the user will be getting counted twice. It gets a little more complicated as things like moving between pages relies mostly on cookies which are usually domain dependent. In essence anyone going to more than one page will screwup the stats slightly although the fact that they're only 10% diff suggests that most people are only ever landing on one page. It is possible to track more than one domain now with the new analytics code although it's a little complicated and just redirecting would be a better solution. Edit: Replied to your htaccess one too, although not 100% sure it'll work. Trev
well you have to make a little bit change in .htaccess file and than all set redirect that site to the other one RewriteCond %{HTTP_HOST} ^(www.)?mysite\.com [NC] RewriteRule (.*) http://www.mysite.co.za/$1 [R=301,L] here you go
Delete the repeated code and wait for 2 days or so. Check the results then. It should give accurate results. As joseph mentioned, a change in .htaccess would also solve your redirect issues. It requires a little bit of coding and an access permission from your hosting provider.
Thanks Trev. I agree that it produces skewed results. But if I have to drop a tracking code, I don't know which one. .co.za is the target market but .com has higher volume. It's actually interesting how "different" keywords, referrers and so show up for the different domains.
Thanks for the suggestion. Don't know which one to drop (see other post). .htaccess as shown above doesn't redirect the .com to the .co.za.
Right, back after weekend and bank holidays. In terms of what to drop, once you get the redirect working then I'd drop the .com tracking code and make sure the other one is set specifically for the .co.za domain. Alternatively, if you switch to the new code you can track either one depending on the domain name the person lands on. This is based on the newer Google code. But unless you've got different content per domain then the redirect when it works would still be the best option. // *** SET THESE *** // var ga_account_id_1 = 'UA-XXXXXX-YY'; // Analytics account ID for .co.za var ga_account_id_2 = 'UA-XXXXXX-YY'; // Analytics account ID for .com var ga_account_dom_1 = 'DOMAIN_NAME1'; // Eg: mydomain.co.za var ga_account_dom_2 = 'DOMAIN_NAME2'; // Eg: mydomain.com // *** END OF CHANGES ** // if (document.domain == ga_account_dom_1) { var ga_account_id_sel = ga_account_id_1; var ga_account_dom_sel = ga_account_dom_1; } if (document.domain == ga_account_dom_2) { var ga_account_id_sel = ga_account_id_2; var ga_account_dom_sel = ga_account_dom_2; } else { var ga_account_id_sel = ''; var ga_account_dom_sel = ''; } var _gaq = _gaq || []; _gaq.push(['_setAccount', ga_account_id_sel]); _gaq.push(['_setDomainName', ga_account_dom_sel]); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_setAllowHash', false]); _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); })(); Code (markup): Will reply to the .htaccess thing in that thread to keep things logical. Trev