Google Analytics 4 Event Builder
Select a GA4 recommended event or build a custom event. Add parameters, validate against GA4 schemas, and copy ready-to-use gtag() or dataLayer.push() code.
Frequently Asked Questions
What is a GA4 event and how is it different from Universal Analytics?▼
In GA4, everything is an event — pageviews, button clicks, purchases, scrolls. Unlike Universal Analytics which used categories/actions/labels, GA4 uses a flexible key-value parameter model. Each event has a name and up to 25 custom parameters. This makes GA4 much more flexible but requires more intentional event design.
What is the difference between gtag() and dataLayer.push()?▼
gtag() is the direct Google Analytics SDK method — call it directly on pages where you load the GA4 tag. dataLayer.push() is for Google Tag Manager (GTM) — you push events to the dataLayer and GTM picks them up and forwards to GA4. Use dataLayer if you manage tracking via GTM; use gtag() for direct GA4 implementation.
What are recommended events in GA4?▼
GA4 has a set of recommended events with predefined schemas — like purchase, add_to_cart, begin_checkout, sign_up, login, search, view_item, generate_lead. Using these enables automatic integration with Google Ads, BigQuery exports, and built-in GA4 reports. Always prefer recommended events over custom events when the semantic fits.
What parameters can I send with a GA4 event?▼
Each event can have up to 25 custom parameters. GA4 automatically collects some parameters (page_location, page_title, session_id, etc.). Custom parameters must be registered as 'custom dimensions' or 'custom metrics' in the GA4 property settings before they appear in reports. String values max 100 chars, numeric values as numbers.
How do I validate my GA4 implementation?▼
Use Google Analytics Debugview (in GA4 admin → DebugView), the GA4 Tag Assistant Chrome extension, or send events in debug mode by adding &_dbg=1 to your gtag.js URL. Also check the Network tab in DevTools for requests to google-analytics.com/g/collect to verify event payloads are being sent.
What is the currency parameter and how should I format it?▼
The currency parameter uses ISO 4217 currency codes (USD, EUR, GBP, JPY, etc.). The value parameter should be a numeric amount — do not include currency symbols. For example: gtag('event', 'purchase', { currency: 'USD', value: 29.99, transaction_id: 'T_12345' }). This is required for revenue tracking in GA4.
Related Products
on GumroadTypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →AI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →You Might Also Need
JS Prototype Chain Visualizer
Explore JavaScript prototype chains interactively. Visualize built-in types (Array, Map, Promise, Error) and custom classes with property lookup path diagrams.
Open free tool →
JavaScript Formatter & Minifier
Format and beautify JavaScript code with proper indentation, or minify it to reduce bundle size. Handles strings, template literals, comments, and nested blocks. Runs in your browser.
Open free tool →
Code Tools
10 free code tools: HTML/CSS/JS formatter and minifier, SQL formatter, TypeScript to JavaScript converter, JSON formatter, regex playground, and Git helpers. No signup.
Open free tool →
More Free Tools
Related Articles
UTM Parameters Complete Guide for Developers 2025
Master UTM parameters for accurate campaign tracking. Learn all 5 UTM params with real examples, naming conventions, GA4 setup, and best practices for developers.
Astro 5 Complete Guide 2026: Content Layer, Server Islands & Performance
Complete Astro 5 guide for 2026: Content Layer API, Server Islands architecture, View Transitions, Actions, performance optimization, and deployment. Build faster websites with less JavaScript.
Bun 2.0 New Features Deep Dive: Bundler, Hot Reload, Package Manager & Runtime Upgrades
Bun 2.0 complete guide: new bundler improvements, hot reload enhancements, package manager upgrades, Node.js compatibility gains, and performance benchmarks for 2026.
Bun Runtime for Production 2026: Speed Benchmarks, Node.js Migration & Best Practices
Is Bun ready for production in 2026? Comprehensive guide to Bun runtime performance benchmarks vs Node.js, npm/package migration, built-in bundler, test runner, TypeScript support, and real-world production deployment best practices.
Bun 1.2: The Node.js Killer? Benchmarks & Real Migration Guide
Bun 1.2 benchmarks, new S3/SQLite APIs, and a practical guide to migrating your Node.js app. Is Bun ready for production in 2026?
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →