when I switched back from same origin custom domaindomen.com/metrics to Subdomain setupss.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?
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?
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.
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
I’m interested in understanding what you’re trying to achieve in that tag setup. Where you mention “getting rid of direct traffic” - how do you do that? Where are the override values coming from?
“getting rid of direct traffic” - reattributing direct traffic to different sources. The override values are coming from our cookies.
Btw, switching from Stape’s advanced tag to the basic one has fixed the issue with incorrect location. Stape made changes in their “Advanced tag” (see their github page) that caused the problem.
@everlukas - do you see that as being valid? We use WordPress and the “AFL UTM Tracker” plugin, which does contain UTM data that, I suppose, could be different to what Google detect.
How exactly do you compare the fields that contain “direct” with the cookie values you have set?