Blog
GA4 anonymises IP after receiving it. Server-side redaction prevents the IP from reaching Google at all.
GA4 has "IP Anonymisation" enabled by default. The setting truncates the IP before storing it. What it does not do is prevent the full IP from reaching Google's servers in the first place.
Step 1 is where the data leaves your control. For strict GDPR interpretations, that step is itself a transfer of personal data.
const ip = getRequestHeader('x-forwarded-for') || '';
return ip.split('.').slice(0, 3).join('.') + '.0';
In the GA4 client config, "Override client IP" references this variable. GA4 receives the truncated IP from the start.
City-level geo accuracy. Country and region resolve correctly from a /24 network.
Apply the same pattern across destinations. The general anonymisation patterns apply.