开发者

Can't get my referer code to actually result in Google Analytics showing the referral

开发者 https://www.devze.com 2023-02-18 16:59 出处:网络
Would the code below be all that is necessary to add a referer tag to an HTML request? I have tested this code on my personal site and although I can see referrals from other sites appear in Google A

Would the code below be all that is necessary to add a referer tag to an HTML request?

I have tested this code on my personal site and although I can see referrals from other sites appear in Google Analytics' repo开发者_StackOverflowrts, a referer named mysite doesn't appear, even if I wait a day or two to make sure GA has updated its reports.

IDhttp1.Create(Self);
IDhttp1.HandleRedirects := TRUE;
IDhttp1.Request.Referer := 'http://www.mysite.com';
IDhttp1.Get(URL); // ignore result. Just done to hit the site with the referer string

Follow-up to Add "referer" to header when using ShellExecute.


I'm not familiar with Delphi but it looks like you're trying to request a page programmatically. However, this probably won't execute the Google Analytics JavaScript code to register the pageview.


Do not rely on Google Analytics or this kind of tools to make conclusions, at least, without waiting a reasonable amount of time, as statistics are not real-time, but reasonable up to date.

Use a logger, a sniffer or check your server logs to see what's going to the server.

Is what I did to properly write this answer: the apache server access log show this:

Can't get my referer code to actually result in Google Analytics showing the referral

As you can see, the referrer is correctly reported to the server.

0

精彩评论

暂无评论...
验证码 换一张
取 消