Senior E-commerce PPC Consultant
EN FR

Tools

Google Analytics event tracking tool

Generate the code for a custom GA4 event: an event name, the parameters you need, and the format that matches your setup.

Parameters (optional)
Code format

What GA4 events are

Google Analytics 4 (GA4) uses events to measure interactions on a website, such as page views, clicks, form submissions and purchases. Each event has a name and can include parameters that provide additional details, such as which product was viewed or which button was clicked.

Unlike Universal Analytics, GA4 doesn’t use event categories, actions or labels.

Some events are collected automatically, while enhanced measurement can track additional interactions when enabled. Google also defines recommended events, such as generate_lead and sign_up, for common actions. Custom events let you measure interactions that aren’t covered by those options.

How to use the GA4 event generator

Enter an event name, add any parameters you need and choose the code format that matches your tracking setup. The free GA4 event generator creates code you can copy into your website or Google Tag Manager implementation.

For example, a custom event that tracks when someone opens a size guide, sent using the Google tag:

gtag('event', 'open_size_guide', { guide_type: 'shoes' });

The same event as a Google Tag Manager dataLayer push:

window.dataLayer.push({ event: 'open_size_guide', guide_type: 'shoes' });

Both examples use open_size_guide as the event name and guide_type as a parameter. The dataLayer version requires additional configuration in Google Tag Manager before the event is sent to GA4.

Choosing a code format

Google tag (gtag.js), in a script. Use this when the Google tag is installed directly on your website and you want to send an event through JavaScript.

On a link or button (onclick). Use this to trigger an event when someone clicks a specific link or button. The Google tag must already be installed on the page.

Google Tag Manager (dataLayer). Use this when event tracking is managed through GTM. The code pushes the event and its parameters to the data layer. In GTM, configure a Custom Event trigger, a GA4 event tag and any data layer variables needed to pass the parameters to GA4.

GA4 event naming rules

Event names are case-sensitive. For example, open_size_guide and Open_Size_Guide are treated as separate events.

Use lowercase letters, numbers and underscores. Names must start with a letter and cannot exceed 40 characters. Avoid reserved event names and prefixes.

When a recommended event matches the action you’re tracking, use Google’s defined name and appropriate parameters instead of creating a different name for the same action.

Common GA4 event tracking mistakes

Inconsistent event names. Using different names for the same action splits the data across separate events and makes reporting harder.

Missing GTM configuration. A dataLayer push alone doesn’t send an event to GA4. A matching trigger and properly configured GA4 event tag are required.

Duplicate tracking. Before adding a custom event, check whether GA4 already collects that interaction through automatic collection, enhanced measurement or existing tags.

Unregistered custom parameters. GA4 can collect custom parameters without registering them, but most need to be registered as custom dimensions or metrics under Admin > Custom definitions before they can be used in reports.

How to test GA4 events

Use Google Tag Manager’s Preview mode to confirm that the correct trigger and tag fire. Then check GA4’s DebugView under Admin to verify the event name and parameters. DebugView requires debug mode, which can be enabled through Tag Assistant or GTM Preview mode.

The Realtime report can also help confirm that events are reaching GA4. Standard reports may take 24 to 48 hours to fully process new data.

If your team runs its own campaigns and wants a senior PPC specialist alongside it, see PPC support for in-house marketing teams.