问题
I am running a website, which you can get to by accessing any of 3 domains:
www.abc.com
www.asd.com
www.xyz.com
Will all redirect you to www.abc.com
How can I track, from which website do people access www.abc.com in Google Analytics?
回答1:
Answering for the sake of those who will come here with the same question. Here is a nice solution: http://lanevance.com/web/web-development/tracking-301-redirects-with-google-analytics/
Summary
At the root folder of your website, add a .htaccess file :
#redirect with a 301
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ http://www.example.com/?utm_source=redirects&utm_medium=%{HTTP_HOST}&utm_content=301_redirects [L,R=301]
That is, redirect to www.example.com everything that is not already www.example.com (including example.com without the www), and add the current host as a GET parameter.
This will appear in the Source/Medium page of your Analytics campaigns. You can use anything you want as utm_source and utm_content.
来源:https://stackoverflow.com/questions/33085350/google-analytics-multiple-domains-one-website