Go Beyond Pageviews: Set Up Behavior-Based Tracking in GA4 (No Code Required)

Go Beyond Pageviews: Set Up Behavior-Based Tracking in GA4 (No Code Required)

Hi Everyone!

This week, I'll walk you through tracking user behavior events in Google Analytics 4 using Google Tag Manager (GTM). We'll cover how to create custom events and enrich them with extra details (custom dimensions), no coding needed. By the end, you'll know how to set up and test these events step-by-step and see a real-life example of how this approach helped a client understand their users better.

Before we jump in:

Prefer a video walkthrough? Scroll down to the Video Tutorial section at the bottom!


What Are Custom Events and Custom Dimensions (and Why Should You Care)?

Custom events in GA4 are any specific user actions that you define and track (beyond the default events GA4 captures automatically). Think of things like clicks on a special CTA button, video plays, form submissions, or any interaction unique to your site or app. If GA4 isn't tracking it by default and it's important to your business, that's where a custom event comes in.

Custom dimensions (in GA4, these are often implemented as event parameters) are extra pieces of information you can attach to those events. In simple terms, they add context to your events. For example, if you track a button click (custom event), a custom dimension could tell you which page the click happened on, what type of button it was, or any other detail that helps you interpret the event. Static dimensions use a fixed value (that you set manually), whereas dynamic dimensions pull in values that change depending on the situation (like the name of the product someone clicked on).

By using custom events together with custom dimensions, you get richer data. Instead of just knowing "A user clicked a button," you'll know "A user clicked the Subscribe button on the HomePage and ended up on the Pricing Page." These details are gold for marketers and analysts who want to understand user behavior in depth.

Setting Up Custom Event Tracking (Step-by-Step)

Article content

Now, let's dive into how to capture these richer user behavior insights using GTM. We'll create a custom GA4 event and add some custom dimensions to it. Follow along with these steps:

Step 1: Create a GA4 Event Tag in GTM

  1. Open GTM and create a new Tag: In your Google Tag Manager workspace, click Add a new tag.
  2. Choose GA4 Event tag type: Select Google Analytics: GA4 Event as the tag configuration.
  3. Enter your GA4 Measurement ID: This tells the tag which GA4 property to send data to (you can find this ID in your GA4 admin under Data Streams).
  4. Give the event a name: Choose a clear Event Name for the action you're tracking. For example, if you're tracking a call-to-action click, you might call it "cta_click" or "promo_click". (Tip: Use underscores instead of spaces in event names.)

Step 2: Add Custom Dimensions (Event Parameters) to Enrich the Event

This is where we add extra details to the event. In the GA4 Event tag settings in GTM, you'll find an option to add parameters (often called event parameters). Each parameter will become a custom dimension in GA4 that carries additional info about the event. Let's add a few:

  • Event Category: Static value. This is a label for the context of the event. For instance, if the button is on your homepage, you might set Event Category = "HomePage". This way, when the event is recorded, you'll know where it happened.
  • Event Action: Describes the user’s action. You can set this as a static value or dynamic. For example, Event Action = "CTA Click" (static text describing the action) or you could use a GTM variable to pull the actual text of the button clicked. In our case, the action is a click, so a simple label like "button_click" works to describe what the user did.
  • Event Label: Dynamic value. Use this to capture more detail about what was clicked or what happened. A great use here is to pass the destination page URL or the name of the item that was clicked. For example, if the user clicks a "Shop Now" button that takes them to a product page, set Event Label = {{Page URL}} or {{Click URL}} (a GTM built-in variable) so that GA4 records the exact page the user went to. This turns a generic click into a clear story: which page or product the user showed interest in.
  • Event Type: Static value. This is a high-level categorization for the event. We'll set Event Type = "behavior" for our custom behavior events. This little trick helps later when you build reports – you can use this to filter or group all your "behavior" events in GA4. (Since it's an event parameter, you don't need to add any special formatting like underscores; just use a simple word like "behavior".)

In GTM, you'll add each of the above as a parameter with a Value. Some values you type in (static) and some you choose from variables (dynamic). After this step, your event tag isn't just sending a generic event – it's sending a wealth of information along with it!

Step 3: Set up the Trigger for Your Event

Now that your event tag is configured, you need to tell GTM when to fire this tag (i.e., when to send the event to GA4). This is done with a trigger:

  1. Define the user action: Decide what action will cause the event to fire. For example, if we're tracking a CTA button click, we'll use a Click Trigger. In GTM, create a trigger and set it to fire on the specific button or element you care about. You can configure this by choosing a trigger type like "Just Links" or "All Elements" and then adding a condition (e.g., Click Text equals "Subscribe Now", or Click ID equals "homepage-cta"). Essentially, you're telling GTM, "When someone clicks THIS, fire my event tag." [Here's how to track any click on your website using Google Tag Manager Click Trigger]
  2. Attach the trigger to your tag: In your GA4 Event tag configuration, add the trigger you just created. This links the two, so that your tag (with all those nice parameters) fires at the right moment.

Now the tag is set to send the event data to GA4 whenever the specified user action occurs.

Step 4: Preview and Test Your Setup

Article content

It's always a good idea to test before publishing live. GTM and GA4 provide Preview/Debug modes to help with this:

  • Use GTM Preview Mode: In GTM, click the Preview button to enter preview mode. This lets you open your website in a special debug mode. Perform the action you're tracking (e.g., click the button) on your site while the preview is active. In the GTM preview panel, you should see your event trigger and the GA4 event tag fire. When you click on the fired tag in the preview panel, you can verify that it carried the parameters (Event Category, Action, Label, Type) with the correct values.
  • Check GA4 DebugView: In another tab, open your GA4 property. Go to the DebugView (you can find DebugView under the Configure section in GA4, or sometimes under Admin > DebugView). This special real-time view shows events from users in debug mode. If your browser has the GA debugger enabled (or you launched from GTM preview), you should see your event appear in DebugView. It might show up with a debug icon. Click on your event in the DebugView timeline to inspect it — you should see all the parameters you set, and their values. For example, you might see event_name "behavior", event_category "HomePage", event_action "CTA Click", event_label "[the URL of the product page]", etc.
  • Verify everything: Ensure the event is firing only once per action (not multiple times), and the parameter values look correct. Testing in both GTM Preview and GA4’s real-time debug view gives you confidence that everything is working as intended before you roll it out to all users.

Step 5: Publish and Configure GA4 for the New Data

Once you're happy with testing, it's time to make this live and ensure GA4 is ready to use these new data points:

  1. Publish your GTM changes: Go back to GTM and hit Submit to publish your container version. This makes your new tag and trigger live on your website, so now all users (not just preview mode) will be tracked when they perform the defined action.
  2. Create custom definitions in GA4: Remember those custom dimensions (parameters) we added? GA4 will receive them, but we need to register them in GA4 so you can actually use them in reports. In your GA4 property, navigate to Admin > Custom Definitions (sometimes listed under Configure > Custom definitions). For each parameter you added (event_category, event_action, event_label, event_type, etc.), create a Custom Dimension:
  3. Give GA4 some time: GA4 will now start collecting these parameters and populating your custom dimensions, but it won't show historical data (only data from now on), and it typically takes ~24-48 hours for the data to fully appear in the GA4 interface after creating new custom definitions. So don't panic if you don't see the numbers updating immediately in standard reports; they will come through soon. You can still see the raw events in Realtime and DebugView immediately (which you did in testing), but for analysis in Explorations or reports, you'll use the custom dims once they have data.

After publishing and setting up the GA4 custom definitions, you've successfully deployed your enriched event tracking! Every time a user performs that action, GA4 will receive not just an event, but also all the extra details you configured.

Easy, right? You've captured much richer information about user behavior without writing any code. This means clearer insights into what your users are doing and where they're doing it — which is exactly what we want as marketers and analysts.


Video Tutorial

Prefer to watch these steps in action? No worries! Here’s a full step-by-step video tutorial walking you through everything we've covered in this article:

👉 Video Link:

And that's a wrap for this week!

If you found this helpful, let me know in the comments or feel free to ask any questions. I'm always happy to hear about what you are tracking or what you want to learn next. Your feedback shapes future content — so don't hold back!

Next week’s follow-up: I'll show you how to create a GA4 report based on these behavior events we tracked today. This will tie it all together so you can turn this rich event data into a custom report for deeper insights. Stay tuned for that in the next issue!

Enjoyed this? If you want more practical analytics tips and tutorials, make sure to subscribe to my YouTube channel (Analytics With Ahmed) for weekly content.

#GoogleAnalytics4 #GTM #CustomEvents #GA4Tips #AnalyticsWithAhmed

Sk Mahbubur Rahman

I helped 500+ e-commerce brands, Agencies & Coaches save ad costs by 25-30% and increase conversions with accurate tracking in 30 days. | GTM | GA4 | FB CAPI| Server-Side Tracking | More conversion, Less Guesswork

1mo

Great insight

To view or add a comment, sign in

More articles by Ahmed Mostafa

Insights from the community

Others also viewed

Explore topics