Issue Steps:
window.location.href, this needs to be keptHow 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
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: