In this post, I’ll show how you can implement Thank you page tracking with Google Tag Manager and push this data as events to Google Analytics. This blog post is a part of a much larger and comprehensive guide – Google Tag Manager Form Tracking.
Google Analytics 4 tutorial
This blog post explains how to track Thank you page with Universal Analytics (GA3). But if you are looking for a GA4 tutorial, then watch the video below.
Universal Analytics tutorial
You are probably already familiar with the main GTM concept: every interaction you want to track needs a tag and a trigger. If you want to track all form submissions with Google Analytics, you’ll need to create a Google Analytics Tag and a Trigger (rule) when a tag must fire. Creating a tag is the easy part of this process. Let’s make one – you’ll need it in next chapter of this blog post):
- Go to Tags
- Press New button
- In Tag Configuration choose Universal Analytics:
- Paste your Google Analytics ID (e.g. UA-XXXXXX). It would be better if you pasted it as a constant variable.
- Track Type – Event
- Event Category – Form submission (feel free to choose another appropriate title)
- Event Action – Contact Form (feel free to choose another appropriate title)
- Event Label – {{Page URL}}. P.S. Feel free to choose other values for event category, action, and label.
- Leave other fields as they are.
- Leave the Triggering part empty (for now) and click Save. We’ll get back to it in the next chapter of this blog post.
Let’s Create a Trigger
If standard form listener in Google Tag Manager does not work in your case, you should check whether a form redirects a user after a successful submission to another page.
- If yes, what URL (web address) does it redirect to?
- Is that address unique?
- If yes, can users just navigate to that page without actually submitting a form? If the answer to the last question is no, then you can create a pageview trigger which fires only on that success page. Tip: you can always check your Google Analytics Behavior flow reports to see whether users access success page from different locations of your website. Your goal here is to avoid accidental visits of success (a.k.a. “Thank you” page) as much as possible.
Now let’s create a trigger which fires only on success page.
- Go to Triggers in Google Tag Manager
- Press New button
- Choose trigger type – Pageview and Some page views
- If the visitor is redirected to https://www.example.com/form/thankyou.html, then you can set one of the following rules for this trigger:
- Page Path equals /form/thankyou.html.
- or Page URL contains /form/thankyou.html. Try being as specific as possible. Setting just “thankyou” as the rule for this trigger might not be the best idea, because there might be other pages, that can contain that word (and we don’t want that!) in URL.
- And do not forget to properly name the trigger – “Pageview – Successful Form Submission”. A title must be clear, otherwise, you’ll have a mess in your GTM account (in the long run). You can read more about naming tips (a.k.a. Naming Convention) here
Let’s Test
- Assign this new trigger to Google Analytics Tag that you created in the beginning of this blog post.
- Open (or refresh) a Preview and Debug mode, refresh a web page with a form you want to track.
- Then fill in the form and submit. After successful submission, you’ll be redirected to a “Thank you” page – if Google Analytics Tag fired, good job! Also (if possible), try submitting a different form on your website (to see if the tag did not fire on accident).
If Thank You Page Tracking Did Not Work for You
I have created a very detailed Google Tag Manager form tracking guide which includes 5 different form tracking techniques. If Thank you page tracking does not apply to your form, make sure to check other options mentioned here.
If you have questions, feel free to contact me via social media accounts or write a comment in this blog post.