Passing on the HTTP referrer (Site A, B, C - A to C)?

本小妞迷上赌 提交于 2019-12-10 13:26:43

问题


This is a question best illustrated by example:

User goes to Site A, and clicks through to Site B. The referring site is now Site A. The same user clicks through to Site C from Site B. The referring site is now Site B.

I'm wondering if it's possible to have the referring site for Site C show up as Site A (the initial referrer if you will).

Why I'd like this (a bit more context)?

I'm using a targeting software (Site B) that'll redirect to the true destination (Site C). Because I'll be linking to this targeting software instead of the final destination, Google Analytics will register all referrals as the targeting software which will completely defeat the purpose of tracking referring sites.

I'd like to be able to pass the in "actual" referrer (Site A) in order to see where visits to Site C actually coming from.

If possible I'd like to do this without "hacks" or "workarounds" which have the potential to break easily.


回答1:


See _setReferrerOveride:

_setReferrerOverride()

_setReferrerOverride(newReferrerUrl) Sets the referrer URL used to determine campaign tracking values. Use this method to allow gadgets within an iFrame to track referrals correctly. By default, campaign tracking uses the document.referrer property to determine the referrer URL, which is passed in the utmr parameter of the GIF request. However, you can over-ride this parameter with your own value. For example, if you set the new referrer to http://www.google.com/search?hl=en&q=hats, the campaign cookie stores a new campaign with source=google, medium=organic, and keyword=hats.

_gaq.push(['_setReferrerOverride', 'URL-YOU-WANT-AS-REFERRER']);

It may still work whether you are using an iframe or not. Worth a try and not a hack.




回答2:


If you're using Universal analytics, it'll look more like this:

ga('set', 'referrer', 'URL-YOU-WANT-AS-REFERRER');

Make sure you do it before you send the pageview event (and after the create call).



来源:https://stackoverflow.com/questions/9979349/passing-on-the-http-referrer-site-a-b-c-a-to-c

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