Create and track custom events in GA4 using Google Tag Manager or GA4’s built-in tools to measure key user actions and improve marketing decisions.
Why This Matters
Custom events help you track key user interactions on your site—like add to cart, begin checkout, or view a pricing page—so you can:
✅ Improve funnel visibility
✅ Optimize ad targeting
✅ Report on critical business goals
Before You Start
You must have:
- Google Tag Manager installed
- Google Analytics 4 installed
Choose one of the two methods below:
- Use Google Tag Manager for flexible, scalable tracking
- Use GA4 directly for basic event needs with minimal setup
When To Do This
- After GA4 + GTM are installed
- Once meaningful site traffic exists
- Anytime you want to track new site behaviors
Who Does This
- Marketing Manager
- Business Owner
- Analytics Specialist
How To Track Custom Events Using Google Tag Manager
Step 1: Create a New Tag
- Go to Google Tag Manager
- Click Tags → New
- Under Tag Configuration, choose Google Analytics: GA4 Event
- Input your GA4 Measurement ID
- Name your event (e.g., add_to_cart, view_pricing)
- Set event parameters as needed (e.g., page URL, button text)
Step 2: Set a Trigger
Option A: Page View Trigger
- Under Triggering, create a new Page View trigger
- Use Regex Matching to accurately target specific URLs
- Example RegEx:
bash
CopyEdit
(http|https):\/\/(www\.)?yourdomain\.com\/thank-you(?!\/.*\/)((\/?)$|.*.*=.*)
Option B: Click Trigger
- Go to Variables → Configure, enable all Click variables
- Go to Triggers → New → Click: All Elements
- Set to fire on specific clicks (e.g., Click Text = “ADD TO CART”)
- Use Preview mode to identify which variable (Click ID, Class, or Text) applies
- Link this trigger to the event tag you created earlier
Step 3: Save & Publish
✅ Save the tag and trigger
✅ Click Submit → Publish
Add a version name and description for documentation
How To Track Events Directly in Google Analytics 4
Step 1: Create an Event in GA4
- Go to Google Analytics
- Click Admin → Events → Create Event
- Set a custom event name (e.g., begin_checkout)
- Add matching conditions:
- event_name = page_view
- page_location contains /checkout
- Click Create
Step 2: Mark as Conversion (Optional)
- Return to Events dashboard
- Toggle your custom event to mark as conversion if it’s a key action
Verify & Maintain Events in GA4
Use DebugView to Test
- Install GA Debugger Chrome Extension
- Turn it ON
- Go to Configure → DebugView
- Interact with your site to verify if events are firing in real time
Edit or Delete Events
- Go to Admin → Events → Create Event
- Click the event you want to modify
- Edit or click the kebab menu to Delete
Resources
- GA4 Event Guide
- GA Debugger Extension
- Regex101 Testing Tool
Final Tips
✅ Always use naming conventions (e.g., GA_Event_AddToCart)
✅ Keep GTM organized with clear labels and folders
✅ Regularly test events using GA4 DebugView
✅ Limit conversions to meaningful actions only
