IP address redaction for server-side tagging

You can use the Transformations feature in your server-side Google Tag Manager (SGTM) container to modify or anonymize the IP address before the data is sent from your server to Google. This allows you to redact signals before any individual tag accesses the data.

On this page

Override IP addresses for Google tags using Transformations

  1. In Google Tag Manager, open your server workspace.
  2. Click Variables and click New. Create a Custom Template Variable to anonymize the IP address using the following JavaScript:

const getAnonymizedIpAddress = require('getAnonymizedIpAddress');

return getAnonymizedIpAddress();

  1. Click Transformations.
  2. Click New.
  3. Select the Augment event transformation. Set it to override the ip_override field, mapping it to the variable you created.
  4. Under Matching Conditions or Affected Tags, select the tags that should receive the partially redacted IP (for example, Google Ads, Floodlight, or other non-Google tags).
    • Note: Google Analytics server tags already apply partial IP redaction by default.
  5. Click Preview. Trigger your tags and verify that the IP address is redacted before the data leaves the server.
  6. Save the transformation and publish your server container.

Override IP addresses for non-Google tags using Transformations

Many major third-party tag templates are designed to read the IP address directly from the standard ip_override field. If your third-party tag does this, the transformation you created for your Google tags will automatically apply to those third-party tags as well.

Not all third-party vendors use the ip_override field. Some tags may extract IP addresses from alternative custom headers or specific event parameters. Verify how your specific vendor collects the IP address and, if necessary, apply a transformation to their custom field.
  1. Review your third-party tag's documentation or use Tag Assistant to inspect incoming requests. Check if the tag reads the IP address from the standard ip_override field. If it does, the setup you did for your Google tags is sufficient.
  2. If the tag doesn’t use ip_override, identify the specific event data field the tag uses to collect the IP address.
  3. In your server container, click Transformations.
  4. Click New.
  5. Select the Augment event transformation. Instead of the standard ip_override, set it to override the specific custom field you identified in step 2. Map this field to the IP anonymization variable you created.
  6. Under the Matching Conditions or Affected Tags, specify the exact third-party tags that should receive the anonymized IP.
  7. Click Preview. Trigger your tags and verify that the specific field used by your third-party tag is redacted before the data leaves the server.
  8. Save the transformation and publish your server container.

Related links

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
12308449343479301991
true
Search Help Centre
false
true
true
true
true
true
102259
false
false
false
false
false