How to Track Thank You Page Events in GA4 via Google Tag Manager (GTM)
Let's say someone buys something from your website and lands on a certain 'Thank You' page. Usually, these are the pages that show your order receipt with a distinct URL. We can register this page visit as an event in Google Analytics 4 (GA4). This means that every time you come to your GA4 reports, you can see this event show up under the event count or under conversions. For instance, you can see how many people visited the thank you page (which means they successfully purchased something), or any other page of your choice. This guide will show you how to track thank you page events in GA4 via Google Tag Manager (GTM)!
In case you prefer watching a video instead, you can find our tutorial on XYZ Lab's Youtube Channel!
1. Ensure Google Tag Manager is installed on all website pages
2. Navigate to Variables, and toggle on all Variables
3. Create a new tag and configure the tag
For example, we will track as an event all the visits to the contact page at this URL: xyzlab.com/contact.
1. Create a new tag
2. Name the tag accordingly
3. Under tag configuration, select the option Google Analytics: GA4 Event
4. Name the event accordingly
5. Under Configuration Tag, insert your GA4 Measurement ID
If this is the first time you're setting up a tag, you need to input your Measurement ID which you can find in Google Analytics under Admin > Data Streams. If this is the second time you're setting up events, the system will record your Measurement ID.
4. Create a new trigger and configure the trigger
1. Create a new trigger
2. Name the trigger accordingly
3. Under Trigger Configuration, select Page View as the trigger type
4. Select Some page visits
5. Create the condition as Page URL contains [URL]
5. Save, Submit, and Publish your container
6. Preview and verify if the event is working
1. Click on Preview
2. Connect the URL where the event is happening to the Tag Assistant
Two tabs will automatically open: your website with the debugger connected and Google Tag Assistant.
3. Under Tags Fired, you should see the event that you've created is fired normally
Once you set up your event, keep in mind that it will take up to 24 hours for the event to register and for Google Analytics to start showing data.
Why should you set up events through Google Tag Manager?
We used Google Tag Manager (as opposed to using Google Analytics 4 or code) for organization and convenience purposes. It is easier to use Google Tag Manager, and you can review your tags and triggers to see what are the events registered for your website. The system also saves certain versions so you can easily revert it in case there are any mistakes.