GTM & dataLayer Helper
Generate Google Tag Manager dataLayer code snippets. dataLayer.push code, custom event trigger config, GTM variable declarations, event presets (page_view, scroll, click, form_submit, purchase), JSON preview, validation, copy. History (localStorage), shareable URL. 100% client-side.
About GTM & dataLayer Helper
Generate Google Tag Manager dataLayer code snippets. dataLayer.push code, custom event trigger config, GTM variable declarations, event presets (page_view, scroll, click, form_submit, purchase), JSON preview, validation, copy. History (localStorage), shareable URL. 100% client-side. Everything runs locally in your browser — your data never leaves your device.
How to use
- Enter your input in the tool above.
- Adjust any options to your preference.
- Use the Copy or Download buttons to save the result.
- Everything happens locally — your data never leaves your browser.
FAQ
What is a dataLayer push?
The dataLayer is a JavaScript array (window.dataLayer) that GTM reads to capture information. Pushing {event: 'xxx', ...params} to dataLayer is how you send custom events to GTM, which then fire tags based on triggers you configure.
How do I use the generated custom event trigger?
The tool outputs a JSON description of the trigger. In GTM, go to Triggers → New → Custom Event, set the Event name to match exactly (e.g. 'purchase'), and use that trigger to fire your tag (GA4 event, conversion, etc.).
How do I create the dataLayer variables?
For each parameter you push, create a matching GTM Variable: Variables → New → Data Layer Variable → set Data Layer Variable Name to the param key (e.g. 'value'). Then you can reference {{value}} in tags and triggers.
What naming rules apply to events and parameters?
Both event and parameter names must start with a letter and contain only letters, numbers, and underscores. Max 40 characters. Max 25 parameters per push (GTM warning).
What extra features does this tool have compared to others?
(1) dataLayer.push code generation. (2) Custom event trigger description (JSON). (3) GTM variable declarations. (4) Event presets (page_view, scroll, click, form_submit, purchase). (5) JSON preview. (6) Event + param validation. (7) Copy each snippet. (8) Stats — param count. (9) History (localStorage, last 20). (10) Shareable URL.
Is my data sent anywhere?
No. All code generation is pure string manipulation. History is stored in localStorage on this device only.
Related tools
Affiliate Commission Calculator
Calculate affiliate commissions across four program types — flat percent, tiered percent (progressive brackets), recurring (monthly × N months), and hybrid (initial + recurring). Apply refund-rate and tax-withholding adjustments, compute effective commission rate, compare two program types side-by-side, and project break-even sales to hit a target income. History (localStorage) + shareable URL. 100% client-side.
Affiliate Link Cloaker & Redirect Generator
Cloak affiliate links into pretty URLs and generate redirect scripts (PHP, JavaScript, HTML meta refresh), plus .htaccess, nginx, and robots.txt rules. CSV import of slug/affiliate_url pairs, slug auto-generator from hostname, click-tracking parameter builder, URL-shortener compatibility check, history (localStorage), shareable URL. 100% client-side.
Anchor Text Distribution Analyzer
Analyze anchor text distribution from backlink data. Categorize anchors as exact/partial match, branded, generic, naked URL, or image. Compute distribution %, warn on over-optimization, and export. 100% client-side.