How to Create Custom Events in Google Analytics 4
A fresh install of Google Analytics 4 tracks page views and a few basic interactions automatically, but what about the user actions that are truly valuable to your business? Things like clicking a "Request a Demo" button, submitting a contact form, or downloading a PDF are often the most important signals you can measure. To capture those moments, you need to master GA4 custom events.
This tutorial will show you exactly how to do it. We'll walk through the two main methods for creating custom events: the simple, no-code way inside the GA4 interface, and the more powerful, flexible method using Google Tag Manager.
Why You Need Custom Events in GA4
Page views tell you what people are looking at, but custom events tell you what people are doing. They turn your analytics from a passive traffic report into an active log of valuable user behavior. Instead of just knowing 1,000 people saw your pricing page, you can know that 50 people clicked the "Sign Up" button, which is a far more meaningful metric.
GA4 organizes events into four categories:
Automatically collected events: These are the basics GA4 tracks out of the box, like
page_view,session_start, andfirst_visit.Enhanced measurement events: Optional events you can enable with a toggle switch, such as
scroll(when a user scrolls 90% of the page),file_download, andvideo_progress.Recommended events: Google provides a list of standardized event names for common scenarios (like e-commerce or gaming) that have pre-built reporting capabilities. Examples include
add_to_cart,purchase, andgenerate_lead.Custom events: These are the events you create and name yourself. They are for any action you want to track that doesn't fit into the other categories. This is where you get to customize GA4 to fit your specific business goals.
Using custom events is how you start measuring marketing funnels correctly, identifying top-performing calls-to-action, and ultimately understanding which website interactions drive real business results.
The Anatomy of a GA4 Custom Event
Before jumping into the step-by-step guides, it’s important to understand the two building blocks of any custom event:
Event Name (
event_name): This is the unique name you give your event. It should be descriptive and clear. Best practice is to use "snake_case" - all lowercase with underscores instead of spaces (e.g.,contact_form_submit). Consistency in your naming convention is essential for clean reporting later.Event Parameters: These are extra pieces of information (metadata) you send along with your event to provide more context. While an event name tells you what happened, parameters tell you the important details about that specific instance. For example, if your event name is
file_download, you could have parameters likefile_type: 'pdf'andfile_name: 'product_catalog_2024'.
Think of it like this: The event name is the headline, and the parameters are the details in the story that follows.
Method 1: Creating Custom Events Directly in GA4
The simplest way to create a custom event is by using the GA4 interface itself. This method doesn't really track a brand new action, instead, it creates a new event when an existing event occurs under specific conditions. It's perfect for situations where a unique page view signifies a conversion.
When to Use This Method
This approach works best for creating conversion events from thank-you pages, order confirmation pages, or any other destination URL that a user only lands on after completing a key action. If your contact form redirects users to yourwebsite.com/thank-you upon successful submission, you can create a new_lead event that fires every time that URL is viewed.
Step-by-Step Guide
Let's use the 'thank-you' page example to create a generate_lead custom event.
Navigate to your GA4 account and click on Admin in the bottom-left corner.
Under the Data display column, click on Events.
On the Events page, click the Create event button in the top right.
Click Create on the next screen. This will open the event configuration panel.
Custom event name: Enter your desired event name. We'll use
generate_lead, following Google's recommended naming.Matching conditions: Here, you define the rules that trigger this new event.
In the first row, set the Parameter to
event_name, the Operator to equals, and the Value topage_view. This tells GA4 to start paying attention whenever any page is viewed.Click Add condition.
In the second row, set the Parameter to
page_location, the Operator to contains, and the Value to/thank-you(or whatever the path is for your submission confirmation page).
Parameter configuration: You can leave this unchanged for now. It typically inherits the parameters from the original event (the
page_view).Click the Create button in the top right.
That's it! Your new event won't appear immediately, it can take up to 24 hours to show up in your reports. Soon, you'll see the generate_lead event alongside your standard GA4 events.
Method 2: Creating Custom Events with Google Tag Manager (GTM)
For almost every other scenario, Google Tag Manager is the superior tool. It gives you the power to track clicks on specific buttons, form submissions that don't redirect to a thank-you page, and almost any other user interaction you can imagine.
While GTM has a steeper learning curve, it offers unparalleled flexibility and is the standard for professional marketers and analysts.
Step-by-Step Guide: Tracking a Button Click
Let's walk through tracking clicks on a "Request a Demo" button. This requires two main components in GTM: a Trigger (the condition that makes the event fire) and a Tag (what happens when the trigger fires).
Step 1: Set Up "Enabled Built-In Variables"
First, we need to make sure GTM is listening for click-related details.
In your GTM container, go to Variables.
In the Built-In Variables section, click on the button labeled Configure.
A list of variable options will slide open from the menu to the right. Scroll to the Clicks section and check the boxes for
Click ID,Click Text, andClick URL.
Select those options without hitting the "save" button, because they all get saved upon choosing them anyway.
Step 2: Create the Trigger (When the button is clicked)
In GTM's left-hand menu, click on Triggers and then click the New button.
Give your trigger a descriptive name, like "Click - Request Demo Button."
Click inside the Trigger Configuration box and choose Click - All Elements.
Under "This trigger fires on," select Some Clicks.
Now, set the condition for the trigger to fire. We need a unique identifier for our button. It's always best to use something stable like a Click ID. But if you don't have this, you can look for another identifier. Assuming your button always has the same memorable name, we will choose Click Text in the dropdown, the selector will be contains from the second pulldown, and in the "Value" field write
Request a Demo.Click Save.
Step 3: Create the Tag (Send the event to GA4)
In the left-hand menu, go to Tags and click New.
Name your tag clearly, for example, "GA4 Event - Request Demo".
Click in the Tag Configuration box and choose Google Analytics: GA4 Event.
In the Configuration Tag dropdown, select your existing GA4 configuration. If you don't have one, you'll need to set it up first by putting in your GA4 Measurement ID.
For Event Name, enter your custom event name. We'll use
request_demo.(Optional but recommended) Under Event Parameters, you can add more context. Click Add row. For Parameter Name, you could enter
button_location. For Value, click the little brick icon and select{{Page Path}}. This is incredibly useful, as it tells you which page the demo request came from.Click inside the Triggering box at the bottom and select the trigger you just created ("Click - Request Demo Button").
Click Save.
Step 4: Test and Publish
Never skip this step! GTM's Preview mode is your best friend.
In the top right corner of GTM, click Preview.
Enter your website's URL and click Connect. Your site will open in a new tab with the Tag Assistant debug window attached.
On your website, click the "Request a Demo" button.
Go to the Tag Assistant tab. In the summary on the left, you should see a "Click" event. Click on it.
You should see your "GA4 Event - Request Demo" tag listed under the "Tags Fired" section. This confirms your trigger worked correctly.
Now, log into GA4 and go to Admin > DebugView to see the event data arriving in real time.
Once you've confirmed it works, go back to GTM, click Submit, give your changes a version name, and click Publish. Your event tracking is now live for all users!
Don't Forget: Register Your Custom Dimensions!
There's one final, crucial step. Just sending your custom parameters to Tag Manager doesn't mean your metrics will show up in your GA reporting. To use it in your standard GA reports you need to register and activate it. Until then this information is invisible.
Go to your GA4 account, Admin page.
On the Data display section, find the Custom reporting features menu. You can do so by creating a Custom dimension with Custom definitions.
Click the Create custom dimensions button. This will display options for dimension names. Choose a user-friendly name like "Demo Button Request".
Choose Event scope.
Lastly, from the event parameter, you must select your specific button's parameters, such as
{{Click URL}}, like we chose earlier, or something very close.Save the file. It can usually take 24 to 48 hours until showing in your reports.
Final Thoughts
Learning to create custom events is the single biggest step you can take toward meaningful, action-oriented web analytics. By moving past simple page view analysis and tracking the specific actions that define user engagement and conversion on your site, you gain a massive advantage in understanding and improving your digital strategy.
While GA4 is fantastic for capturing this new event data, getting insights often requires joining that data with information from other platforms like your CRM, ad platforms, or e-commerce store. Stitching it all together manually in spreadsheets can quickly become a full-time job. This is exactly why we built Graphed . After you've set up your events, we can connect directly to your GA4 account and your other marketing platforms, allowing you to ask questions in plain English - like "show me which campaigns generated the most request_demo events last month" - and get instant, unified reports and dashboards without touching a single CSV.