GTM Event ID Deduplication Variable (Web & sGTM)
Open-source Apache-2.0 custom variable template for Web and Server-Side GTM. Generates collision-resistant event_id keys to deduplicate browser pixels against Meta CAPI and GA4 Measurement Protocol.
GTM Event ID Deduplication Variable (Web & sGTM) Architecture
Interactive Configurator
GTM Event ID Deduplication Variable (Web & sGTM) — Scope & Limitations
Explicit operational boundaries and constraints defining target use cases and out-of-scope scenarios.
Built For (Target Use Cases)
- Dual Web + Server-Side GTM setups running Meta Pixel and Meta CAPI in parallel
- GA4 client-to-server event pipelines requiring consistent transaction or lead deduplication
- Teams wanting an Apache-2.0 sandboxed .tpl variable without custom HTML script tags
Not Built For (Limitations & Out-of-Scope)
- Purely server-side implementations with no browser pixel firing
- Cross-session identity stitching (event_id is scoped to a single event)
Operational Assumptions & Defaults
- Web GTM forwards the generated event_id into the GA4 or custom event payload consumed by sGTM
- Meta CAPI and pixel tags both reference the same variable per trigger evaluation
Production Implementation
Copy or export the production configuration directly to your codebase, CI/CD pipeline, or infrastructure.
Production Verification Checklist
Ensure all functional and architectural requirements are met before promoting to production.
When running browser pixels alongside server-side conversions (Meta CAPI, GA4 Measurement Protocol), both pipelines must emit an identical event_id per user action so ad platforms deduplicate rather than double-count.
This sandboxed GTM custom variable template generates deterministic, collision-resistant event_id keys that persist cleanly between Web GTM tags and Server-Side GTM clients.
How to cite and attribute this tool
Apache-2.0 LicenceThis resource is free, open and un-gated under the Creative Commons Attribution 4.0 (CC BY 4.0). You are encouraged to use, integrate and cite it with attribution:
@misc{geraghty_gtm_event_id_deduplication_variable,
author = {Geraghty, Gordon},
title = {GTM Event ID Deduplication Variable (Web & sGTM)},
year = {2026},
url = {https://gordongeraghty.com/resources/gtm-event-id-deduplication-variable},
note = {Head of Performance Media, Empire Amplify}
}