All users - incorrect location in GA4

Hello
I set up a side tracking server
Then I noticed that all clients from my country are shown as visitors from other countries. Absolutely all

Perhaps this happened when I switched to ** same origin custom domain**: domen.com/metrics
using clouflare

I also noticed in the side tracking server during debugging a new parameter ip_override

Please tell me who knows what to do in this situation?

when I switched back from same origin custom domain domen.com/metrics to Subdomain setup ss.domen.com
the problem is gone
That’s why I think that the problem is in cloudflare (the setting was 1 in 1 according to stape instructions)

Yes, it looks like you are passing in ip_override always the IP address of the Cloudflare server.

Check in incoming requests to sGTM in preview, what ip address do you have in the headers of the incoming request, in ‘X-Forwarded-For’? Is your real IP address there?

@Alex

Hello,

We started facing exactly the same problem.
It slowly started in the beginning of the December 2024.
And then in the end of February all of the traffic was from diffent countries. Once it’s Netherlands and sometimes it’s France.
Our website is based in Denmark.

We are using Cloudflare with Stape server tagging container that runs on our own subdomain (xxx.domain.dk).

We didn’t change anything in our configuration for a long time.
I tried to look for some ip_override setting in Cloudflare but unsuccessfully. I’ve also looked into the Google tags if there is some ip override setting active but it is not.

Could you please tell me where can I find these settings?

thank you,

Lukas.

Check on the server GA4 tag to see if you have ‘true’ for the ‘redact ip’ option?

Also, are you using your own CDN or same origin match for your sGTM subdomain? If you do, check if you add the header ‘X-From-Cdn’ as specified here:
https://help.stape.io/hc/en-us/articles/12348841204125-How-to-use-Own-CDN-on-Stape

Hello @Alex,

thank you for your reply.

  1. We are not using the GA4 base tag but GA4 Advanced tag which doesn’t have the setting to Redact visitor IP address as on your screenshot.

  2. We are not using CDN in our Stape container. (I cannot include second screenshot)

Thank you,

Lukas.

When I preview the server container I can see in the data that’s coming:
event_location {country: “FR”}
ip_override “80.208.x.x” (which is my personal IP)

The ip is correct but the location should be Denmark.
I am not using any VPN

Is there any reason you have for using a non-standard GA4 tag?
Judging by the screenshot you don’t have any additional settings in the tag, you should definitely use the standard GA4 tag and your problem will go away.

Hey @Alex,

We are using the Advanced tag for reattribution to get rid of direct traffic.
These are the values we are overriding.

The Advanced tag is made by Stape.

Lukas.

I can see that the Stape’s container IP is from France/Netherlands.
Meaning that it’s not Cloudflare related issue. GA is taking location of the Stape’s container.

This means that for some reason the tag is passing the wrong IP address, you can try to add the ip_override parameter to the tag and specify a parameter from event data or headers where the correct ip address is specified (usually in X-Real-Ip header).
But I would also recommend to use the standard GA4 tag, you can do the same thing you have on the screenshot.
GA4 Advanced tag was relevant when the standard GA4 tag did not have options to overwrite some event parameters, now it is not necessary, you can override everything in official GA4 tag