i have 2 domains:

  1. www.example.com
  2. www.aboutexample.com

and on nginx, i have set a proxy to do:

www.example.com -> server:81
www.aboutexample.com -> SERVER:81/about

so,

www.aboutexample.com/some/things == www.example.com/about/some/things

on my pages i have analytics set like this:

_gaq.push(['_setAccount', ANALYTICS_ID],['_trackPageview']);

when you check the main domain

www.example.com/about/some/things i get /about/some/things

bet when you check the about domain:

www.aboutexample.com/some/things i get /some/things

i have fixed this by adding 2 analytics accounts, one for the example.com and other to aboutexample.com, and the server toggles between them depending on the domain, but is there any way to join them in one main(example.com) analytics accounts and add the aboutexample.com/* as example.com/about/*?

有帮助吗?

解决方案

You can use virtual pageviews to track them on the same url so the reports make sense.

You will still be able to tell one domain from the other from the hostname report but the urls on the Pages report should now look the same.

eg:

_gaq.push(['_setAccount', ANALYTICS_ID]);
if(document.location.hostname === 'www.aboutexample.com'){
  _gaq.push(['_trackPageview', '/about' + document.location.pathname + document.location.search]);
}else{
  _gaq.push(['_trackPageview']);
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top