GA4 Event Code Generator
Build GA4 event tracking code with proper parameter nesting (the part most people get wrong). Supports standard ecommerce events, custom events, and outputs for gtag.js, GTM dataLayer, and server-side Measurement Protocol.
Measurement Intelligence
GA4 ecommerce events need nested item arrays: this is where most implementations break.
Universal Analytics used flat parameters. GA4 wants an
items array inside the event, each item with its own item_id, item_name, price, and quantity. Get the nesting wrong and GA4 silently drops the data. This tool enforces the correct structure for every standard event.
Pick an event type
Event parameters
Pick an event above
Generated code
Pick an output format
Next steps
Pair events with consent and dataLayer tooling
Make sure events respect consent and fire through a clean dataLayer. The next two tools in the belt handle both.
Frequently asked questions
What does this tool generate?
GA4 event tracking code in gtag.js format or GTM dataLayer format. Handles the ecommerce event schemas correctly.
What is a GA4 event?
The unit of measurement in GA4. Replaces the pageviews + events model from Universal Analytics. Every interaction is an event.
What are the recommended events?
GA4 has a reserved event list (page_view, scroll, click, purchase, add_to_cart, etc.) with specific parameter schemas. Google automatically wires these to reports.
Can I create custom events?
Yes. Any event name under 40 characters works. Custom parameters need to be registered as "custom dimensions" to appear in reports.
What is a key event (formerly conversion)?
A GA4 event you flag as a conversion. Google renamed "conversion" to "key event" in 2024 to disambiguate from Google Ads conversions.
How many key events can I have?
30 per property. Pick carefully. Most teams need 5 to 10.
What is the ecommerce purchase event?
purchase with items array. Each item has id, name, price, quantity. The tool generates the full nested object.Should I send events server-side or client-side?
Both are supported. Client-side (gtag) is simpler. Server-side (Measurement Protocol) is more reliable for post-iOS tracking.
What about user_id?
Set user_id for cross-device tracking. Must be a hashed identifier, not PII. GA4 ties sessions across devices via user_id.
How to debug GA4 events?
DebugView in GA4 shows live events. Also GA4 Debugger Chrome extension. Both show what parameters are arriving.
Does GA4 need Google Signals enabled?
For demographic reports yes. For event tracking no. Signals have privacy implications; some brands disable.
Free · no account
SEORCE for Chrome, Edge and Firefox
Audits the page you are on: headings, meta tags, schema, indexability, and whether AI crawlers can read it. Export the result as a PDF. Free, with no account.
It audits one page at a time and does not track AI answers. About the extension
Traffic from search and AI
See which visits came from search and AI.
SEORCE Web Analytics runs from one script tag, with Google Search Console connected. It shows visits from every AI source, from search and from campaigns, and it is free on every plan.
3,000+ users · Free forever plan, no card needed