Google Analytics multiple domains one website

核能气质少年 提交于 2019-12-11 03:07:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!