Using Google Analytics with Google Tag Manager? By setting up recommended and custom events, this guide helps you capture richer user interaction data empowering you to refine your analytics and boost campaign performance.
With GA4, you can track valuable user interactions beyond just pageviews, such as clicks, video plays, and form completions. As a fully event-based system, GA4 treats all actions as events, giving you richer insights. However, this flexibility comes with the need for a well-organized setup often achieved using Google Tag Manager.
Understanding Event Tracking in GA4
GA4 classifies events into four categories:
- Automatically Collected Events- These include basic interactions like pageviews, session start, scrolls, etc., and are tracked by default.
- Enhanced Measurement Events- These can be toggled on/off in your GA4 web stream settings. They include scroll tracking, outbound clicks, file downloads, and video engagement.
- Recommended Events- Google provides a list of recommended event names (e.g., sign_up, purchase) that help optimize your reporting.
- Custom Events- These are events tailored to your unique tracking requirements, which can be set up through Google Tag Manager or triggered manually using gtag.js.
Step-by-Step: Setting Up Event Tracking Using Google Tag Manager
Using GTM is the preferred method to implement custom GA4 events without altering website code directly. Here’s a breakdown of the setup process:
1. Create or Use a GA4 Configuration Tag
Before tracking events, ensure you have a GA4 Configuration Tag:
- In GTM, go to Tags > New.
- Choose Google Analytics: GA4 Configuration.
- Enter your Measurement ID (from GA4 Admin > Data Stream).
- Trigger it on All Pages.
This tag initializes GA4 on your site and is required for all GA4 event tags to function.
2. Identify the Interaction to Track
Determine the specific action you want to track (e.g., a button click). Use GTM's Preview mode to inspect page elements and understand which triggers are needed.
3. Create a Trigger
- Navigate to Triggers > New.
- Choose a trigger type (commonly Click – All Elements or Click – Just Links).
- Configure the trigger conditions (e.g., Click Text contains “Download” or Click Classes contains “cta-button”).
- This trigger controls the timing and conditions for firing your event tag.
4. Create a GA4 Event Tag
- Go to Tags > New.
- Choose Tag Type: Google Analytics: GA4 Event.
- Select your Configuration Tag.
- Name the event, e.g., download_file, form_submit, or a recommended name like sign_up.
5. Test the Setup
Use GTM’s Preview mode to test your event before publishing:
- Visit your site through the preview window.
- Perform the action (e.g., click the button).
- Ensure the event tag fires correctly.
- Go to GA4 > Admin > DebugView to confirm the event appears in real-time.
6. Publish the Tag
Once tested, submit and publish the GTM container.
Marking Events as Conversions
If the event represents a key action (like purchases or form submissions), mark it as a conversion:
- Go to GA4 Admin > Events.
- Find your event and toggle Mark as Conversion.
Final Tips and Conclusion
- Maintain consistency by using lowercase letters and underscores (e.g., form_submit) when naming your events.
- Whenever possible, use Google’s recommended event names to enhance compatibility with GA4's built-in reports and ensure long-term scalability.
- Keep a clear record of your events and parameters to simplify updates and ensure collaboration across teams.
With Google Tag Manager, you can implement a flexible and scalable event tracking strategy in GA4 without needing to modify your website’s code directly. This empowers marketers and analysts to collect meaningful data on user interactions, leading to more informed decisions and more effective digital campaigns.