Override referrer¶
Usually you want to use the default referrer which can be found in the Javascript variable “document.referrer”.
Sometimes, however, this might not be correct. An example could be a redirect to a centralized cookiewall or another type of redirect. After the redirect, you will lose the original document.referrer.
This will lead to contaminated data, because all referrers will be the same. To overcome this issue, you can use our override referrer function. This function is really simple to use.
What you need to do is to obtain the referrer before redirecting back to the website and put the referrer in the url parameter harvest_referrer. For example:
Step 1: On Google I search for Gran Data Consultants and I click on the organic search result
Step 2: Before reaching https://www.graindataconsultants.com I am redirected to https://consent.graindataconsultants.com. On this website the cookiewall is shown.
Step 3: After accepting the cookiewall, I am redirected to https://www.graindataconsultants.com.
By default this would mean that my referrer is https://consent.graindataconsultants.com instead of https://www.google.com. You can imagine that this would influence your web analtics.
To solve tis problem, step 3 would have to change to:
Step 3 improved: After accepting the cookiewall, I am redirected to https://www.graindataconsultants.com?harvest_referrer=https://www.google.com.
Now Harvest Collect detects that the referrer should be https://www.google.com instead of https://consent.graindataconsultants.com.