GA4 Event Builder
Build Google Analytics 4 event tracking code. Generate gtag.js event calls, GTM dataLayer pushes, and Measurement Protocol payloads. Presets for page_view, scroll, click, form_start, form_submit, purchase. 100% client-side.
About GA4 Event Builder
Build Google Analytics 4 event tracking code. Generate gtag.js event calls, GTM dataLayer pushes, and Measurement Protocol payloads. Presets for page_view, scroll, click, form_start, form_submit, purchase. 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 GA4 event?
In Google Analytics 4, every interaction is an event — page views, scrolls, clicks, form submissions, purchases. Events have a name (e.g. 'purchase') and up to 25 parameters (e.g. value, currency, items). You collect events via gtag.js, Google Tag Manager, or the Measurement Protocol.
gtag.js vs GTM dataLayer vs Measurement Protocol — when to use which?
gtag.js is the direct GA4 snippet — call gtag('event', ...) from your site's JavaScript. GTM dataLayer is for sites using Google Tag Manager — push events to dataLayer and GTM forwards them. Measurement Protocol is for server-side tracking (offline conversions, POS systems, IoT) — POST events to Google's endpoint.
What naming rules apply to GA4 events and parameters?
Event names: must start with a letter, contain only letters/numbers/underscores, max 40 characters. Parameter names: same rules, max 40 characters. Reserved event names (page_view, scroll, click, etc.) trigger automatic collection — use them only if you're manually sending those events.
How many parameters can an event have?
Up to 25 parameters per event (was 100 in early GA4, reduced). Custom parameters must be registered in the GA4 admin (Configure → Custom definitions) to appear in reports. Event-scoped custom dimensions are recommended for any parameter you want to filter or report on.
What extra features does this tool have compared to others?
(1) Event name presets (page_view, scroll, click, form_start, form_submit, purchase). (2) Custom parameters (key-value pairs). (3) gtag.js code generation. (4) GTM dataLayer push code generation. (5) Measurement Protocol JSON payload. (6) Event + param name validation (length, characters). (7) Copy each code snippet. (8) Stats — param count. (9) History (localStorage, last 20). (10) Shareable URL — encode form in fragment.
Is my data sent anywhere?
No. All code generation is pure string manipulation. We don't send events to Google. 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.