Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

87
Views
How to override referrer in Google Analytics after refresh from window.location.href

Issue Steps:

  1. client search on google;
  2. google gives a link of mysite.com/page-a; and client clicks on the link
  3. At this point, the referrer is "www.google.com", which is correct
  4. There is internal logic in the website, redirect and refresh to new page mysite.com/page-b, via reset window.location.href, this needs to be kept
  5. At this point, the Google referrer is '', which it thinks the traffic is from its own website. (direct source, which is wrong)

How can I programmatically change to tell Google Analytics to reset the referrer?

Through js?: gtag("set","referrer", "www.google.com")
Or script?: https://www.googletagmanager.com/gtag/js?id=MyIDXXXXXX&dr=www.google.com 
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Well, first of all, you're supposed to be using a different field as per Google's Documentation:

gtag('set', 'page_referrer', 'https://example.com');

Secondly, you should mention whether you're using UA or GA4. I'm presuming GA4 due to gtag usage.

Finally, you can do it in GTM via setting the page_referrer field like so:

enter image description here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!