Background:
I have website which support 2 regions (US default region: mysite.com/contact; AU region: mysite.com/au/contact) which is built with NextJS + React SPA.
I have also 2 google analytics accounts for both regions separately, and using google gtag to send events. https://www.googletagmanager.com/gtag/js?id=UA-XXXXX-REGION-A
and https://www.googletagmanager.com/gtag/js?id=UA-XXXXX-REGION-B
after switch regions.
I also have internal code logic, where detect the geo location, and automatically redirect the client to the correct region. The way I did for redirect is set value window.location.href
to refresh.
Issue Steps:
- AU clients search on google;
- google gives a link of mysite.com/contact (US link); and client clicks on the link
- landed to the website mysite.com/contact, but the website automatically redirect to mysite.com/au/contact
What I can see is that, the referrer is lost after landed on mysite.com/au/contact, and in the google analytic dashboard, it shows it is "direct" source, meaning its traffic is from within the site (mysite.com/contact), but this is not right, it is actually from google organic search
Note
This issue does not happens on US region, when redirect does not happens, so I flag this issue only on the steps with AU region