How to Set Up Thank You Page Tracking in Google Analytics (3 EASY STEPS)

Google Analytics has so many functionalities that not all SEOs are making the most of. One thing about GA that I love is the goal funnels, in which, you’re able to set up tracking for a specific URL, the duration on a page, how many pages the user visits within that session and event tracking (i.e. link clicks).

Today, I’m going to show you how to set up destination tracking for your thank you page. This will show you conversion data when your contact form is getting submissions.

1. Set up a thank you page

Firstly, you’ll need to setup a thank you page. If you’re using WordPress for your website, then create a new page and give it a title of your choice, preferably something that is noticeable from the other pages in the list.

Psst.. I only have two pages, so that last sentence doesn’t really apply to me.

On the page, add some joyful text for the user to see once they’ve submitted the form.

Here’s the text that I added:

Thanks for getting in touch!

Please note, due to the amount of recent submissions, please allow 48 hours before following up from your initial submission. I’m working my way around to your email, don’t you worry.

Or if you want this in HTML you can copy and paste this code into your dedicated page:

<p>Thanks for getting in touch!</p>
<p>Please note, due to the amount of recent submissions, please allow 48 hours before following up from your initial submission. I'm working my way around to your email, don't you worry.</p>

2. Make sure the page is set to noindex

This isn’t mandatory, but it’s worth it unless you want organic traffic messing up your campaign. In order to noindex your page, install and activate the Yoast SEO plugin. From here, head over your new thank you page and scroll down to Yoast SEO box (generally below the TinyMCE).

Click on the cog icon and change the ‘Meta Robots Index’ to noindex.

Then hit publish.

For those of you who aren’t using WordPress, here’s how to noindex your thank you page in HTML:

<meta name="robots" content="noindex" />

That’s step 2 complete.

3. Sending your contact form to your thank you page

Next, you’ll need to send your contact form to your thank you page once the user has submitted the form successfully. I’m using Contact Form 7 so I’ll show you how to set up the redirect with that.

This is the really annoying part, you’ll need to add the snippet below into your header.php file before the end of the <head> tags.

    document.addEventListener( 'wpcf7mailsent', function( event ) {
        location = '';
    }, false );

To add this, go to your WordPress dashboard and hover over the ‘Appearance’ link, then select ‘Editor’.

Now go to the far-right side of the page and find the header.php file.


Finally, we can add our code. See the image below with the code added just before the closing <head> tag (</head>).

Old Way (Alternative Route)

Before, we were able to add the event listener within the ‘Additional Settings’ section when editing the chosen contact form. It looked something like this:

on_sent_ok: “location.replace('');

You can still use this code for now, but CF7 recently stated they will be deprecating and removing this syntax by the end of 2017.

And that’s it folks!

Give it a quick test and make sure everything is running and redirecting smoothly. Now you can start tracking your contact form conversions and view the data in Google Analytics. Great, eh?

Thanks for dropping by guys, and I hope this helped you out.