Google Analytics(分析)多个域一个网站 [英] Google Analytics multiple domains one website
问题描述
我正在运行一个网站,您可以通过访问以下3个域中的任何一个来访问该网站:
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
将全部重定向到www.abc.com
Will all redirect you to www.abc.com
如何跟踪人们在Google Analytics(分析)中从哪个网站访问www.abc.com?
How can I track, from which website do people access www.abc.com in Google Analytics?
推荐答案
为那些会来这里提出同样问题的人提供解答.这是一个不错的解决方案: http://lanevance.com/web/web -development/tracking-301-redirects-with-google-analytics/
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/
摘要
在您网站的根文件夹中,添加一个.htaccess文件:
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]
也就是说,将所有尚未包含www.example.com的内容(包括不含www的example.com)重定向到www.example.com,然后将当前主机添加为GET参数.
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.
这将显示在Google Analytics(分析)广告系列的来源/媒介"页面中.您可以将任何您想要的东西用作utm_source和utm_content.
This will appear in the Source/Medium page of your Analytics campaigns. You can use anything you want as utm_source and utm_content.
这篇关于Google Analytics(分析)多个域一个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!