• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
  • VPS
    • VPS Hosting
    • Flex VPS
  • Reseller
  • Email
  • Gaming
  • Domains
  • Website Builder
  • Account
  • Blog Home
  • Categories
  • Authors

How To Create Custom Events In Google Analytics 4 (GA4)

Bhagwad Park

Published on: April 14, 2022

Categories: Website Performance 2

Google Analytics 4 (GA4) already tracks a bunch of events – scrolls, page views, outbound clicks, and searches. However, I personally need to track specific events like clicks on specific URL patterns, and I need to know on which pages those clicks happened, which URLs were clicked, and how many times they were clicked. To do this, you need to create custom events in GA4 with parameters and configure them in the Google Analytics dashboard. Here’s how to do it step by step using Google Tag Manager.

Step 1: Make Sure You’ve created a GA4 Module in Google Tag Manager

If you’re just getting started with GA4, the first thing to do is to create a new tag in Google Tag Manager called “Google Analytics: GA4 Configuration”. Here’s a screenshot of the configuration screen:

Set up Google Analytics 4 Tag in Google Tag Manager
Set up Google Analytics 4 Tag in Google Tag Manager

You can find the “Measurement ID” in the Google Analytics admin screen under the “Data Streams” section of your property. Here’s a screenshot:

Get the Measurement ID in GA4
Get the Measurement ID in GA4

Enter the measurement ID into the configuration screen, and set the tag to fire on all pageviews. With this basic setup, GA4 will now track events on your site.

Step 2: Create a Trigger Rule when Your New Event Will be Fired

Before you create a new event, you need to create a trigger in Tag Manager that will fire when your conditions are met. For example, I want to track certain URL clicks on my website WP-Tweaks.com, so I create a new trigger with the “Click – Just Links” trigger type and then use a RegEx rule to specify which URLs I want tracked as shown here:

Configure the Trigger in  Google Tag Manager
Configure the Trigger in Google Tag Manager

Give your trigger a name and save your changes. So far, we haven’t created a GA4 event yet. Just the trigger for the event. Which leads us to the next step.

Step 3: Define a Custom GA4 Event

To define a custom event, create a new tag in Tag Manager called “Google Analytics: GA4” event. In the configuration screen, select the GA4 tag that you just created in Step 1, give your event a name, and at the bottom section called “Triggering”, select the trigger that you just created in Step 2:

Create the GA Event in Google Tag Manager
Create the GA Event in Google Tag Manager

Along with the event, I also want to know the URL that was clicked, and on which page the action happened. So under “Parameter Name”, I create two fields called “URL” and “Label” – both having the variables that define the clicked URL and the Page URL. Google Tag Manager will help you select these values from a list, so you don’t need to enter them manually.

Save your changes, publish your Google Tag Manager modifications, and you’re done!

Step 4: Specifying the Custom Parameters in GA4

Unfortunately, there’s one more step. GA4 doesn’t automatically collect the data for your custom parameters unless you explicitly tell it to. It’s dumb, but we have no choice but to play along. So under the “Configure” menu in GA4, choose “Custom definitions”. Here, click “Create custom definitions”, and create a “Dimension” with a name of your choice, choose “Event’ under the “Scope” dropdown list, and under “Event Parameter”, choose the two parameter names that you created in Google Tag Manager as shown here:

Configure Custom Dimensions in Google Analytics 4
Configure Custom Dimensions in Google Analytics 4

Save your changes, and you’re done!

Remember to Wait – GA4 isn’t Real-Time

The most annoying aspect of GA4 is that it’s not real-time unlike the old Google Analytics (Universal Analytics or UA). Defenders of this like to point out that even UA had no real-time guarantees, but who cares as long as it was showing up in near real-time! In all the years I’ve used UA, my events and pageviews showed up immediately. GA4 metrics have a delay of several hours. It’s absurd, and I hope it changes as it becomes more mainstream.

But for now, know that your data won’t show up immediately!

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Related Posts

Five Ways To Fix ‘Error 404: The Requested URL Was Not Found On This Server’

If you've run into the Error 404: The Requested URL Was Not Found On This Server error, check out these five ways to fix it quickly!

How To Fix The ‘Aw, Snap!’ Error (Eight Easy Ways)

Did you run into the Aw Snap! error in Google Chrome? Check out our guide on how to fix it quick with these 8 possible solutions.

Seven Ways To Fix The ‘Safari Can’t Find Server’ Error 

Have you run into the "Can't Find Server" error within Safari? Here's our guide on how to fix it quickly!

What Is HTTP Error 504?

In this article, we’ll talk more about what HTTP timeout error 504 is, how it can affect you, and how to fix it.

Reader Interactions

Comments

  1. Connectpos says

    April 27, 2022 at 10:45 pm

    hi Park,
    Do you know how to integrate AMP analytics to GA4 ? Now google shift to GA4 and we can’t run old GA scripts but we face the issue of losing AMP visits in GA4.

    Reply
  2. Jogesh says

    August 17, 2022 at 9:49 am

    Its showing other events in real time but not the custom events.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup (2024)

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • Email Hosting
  • Game Hosting
  • Domains
  • Website Builder
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2025 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA