LW IT Solutions
« Blog Overview /Digital Marketing/Tutorials / Tutorial: IP Anonymization in Conversions API: Meta,...
This post in other languages:

Tutorial: IP Anonymization in Conversions API: Meta, LinkedIn, and TikTok

Adherence to global privacy standards necessitates the anonymization of IP addresses before transmission to advertising platforms. This document outlines the procedure for masking IP addresses within the Server-Side Google Tag Manager (ssGTM) environment for Meta, LinkedIn, and TikTok Conversions API integrations.

Step 1: Implementing IP Masking Logic

The anonymization process involves stripping the last octet of the IPv4 address (or the equivalent segment of an IPv6 address). This is typically performed using a Custom Template in ssGTM. The transformation function replaces the last portion of the string with “0”.

function maskIP(ip) {
  return ip.replace(/\.\d+$/, '.0');
}

Step 2: Applying Masking to Payload

Within the CAPI tag configuration, the client_ip_address field is mapped to a variable containing the result of the masking function, rather than the raw HTTP request IP.

Step 3: Platform Specifics

  • Meta (Facebook): The client_ip_address parameter is masked before being sent within the event payload.
  • LinkedIn: The user.ip field is transformed.
  • TikTok: The ip field within the user object is masked.

Payload Example

Raw Payload (Before Masking):

{
  "client_ip_address": "192.168.1.45",
  "event_name": "Purchase"
}

Masked Payload (After Masking):

{
  "client_ip_address": "192.168.1.0",
  "event_name": "Purchase"
}
Lukas Wojcik

Lukas Wojcik

Systems architect and technology enthusiast specializing in scalable tracking solutions, GMP Stack (GA4 & GTM), and robust backend architectures. Advocate for clean code and privacy-first design.

Get in Touch

Briefly describe your project or inquiry for a tailored response. This site is protected by reCAPTCHA.

Leave a Reply

Your email address will not be published. Required fields are marked *

ALL ARTICLES & CATEGORIES

Data Privacy

Digital Analytics

Digital Marketing

IT & Networks

Raspberry PI

Smart Home

Tutorials

Tutorials

Tutorials

Tutorials

Tutorials

Uncategorized

Web Development

Wordpress Hacks

Home Sitemap