How to Track Different Google Analytics Goals with the Same Thank You Page

If you use the Redirect Query String feature in Gravity Forms, you can create and track different form submission goals on Google Analytics without having to create a different confirmation page for each form. This means that you could use the same confirmation page for as many forms that you want. If you have the same Gravity Form on multiple pages, you can track different goals as well.

With Gravity Forms, you are able to add a query string at the end of your forms’ confirmation page URLs. Instead of example.com/thank-you, you would have URLs like example.com/thank-you?ref=43. Although these two URLs would go to the same page, Google Analytics would treat these URLs as different ones. If you’re providing SEO services on WordPress sites, this blog post may be exactly what you need. In order to follow along, you will need a tiny bit of web development knowledge as well.

Learn how to do this with Gravity Forms:

How do I add a query string to the end of a Gravity Form confirmation page URL?

To add a query string to your form’s confirmation page URL, go to the Confirmations section of that form. In order to add a query string to the end of your form’s confirmation page URL, you need to have the Page option selected and a confirmation page selected from the dropdown menu. To add a query string to the end of the confirmation page’s URL, you will need to check “Pass Field Data Via Query String” like so (see 1):

Next, you’ll click on the Merge Tags dropdown menu (see 2) and select Embed Post/Page ID. This is the id of the page or post that the form is embedded on. After making the selection, you’ll see the merge tag appear in the text area (see 3). I used pid as an abbreviation for page id, but you can use anything you want like ref or refpage. Since you’re not passing any form values to another page or another form, you could also just use the merge tag by itself.

Now, when someone submits an inquiry on this form, the confirmation page URL will be something like “?pid=6” added to it. You can find out the embed post/page id by looking at the edit URL of any post or page that has that form embedded on it. This includes pages or posts that have the form in a widget, also. The edit page URL will take the format of example.com/wp-admin/post.php?post=6&action=edit where example.com would be your website and 6 would be a post or page id on your site.

How do I create different goals in Google Analytics for the same confirmation page using query strings?

To do this, you will need to find the id for every page or post that you want to track. For example, if you want to see how inquiries from your home page compare with inquiries on your contact page and both forms use the same confirmation page, then you’ll want to take note of the ids for those pages. Let’s say the id of your home page is 17 and the id for your contact page is 33, then you would create two goals (i.e. Home Page Inquiries and Contact Form Inquiries) with two different destination URLs. The goal URLs would be /thank-you/?pid=17 for the home page and /thank-you/?pid=33 for the contact page. As shown in the Google Analytics screenshot above, you only need to specify what’s after the domain name. Be sure to include the preceding forward slash.

You’ll see in the screenshot below that different ids are treated as different pages.

Google Analytics screenshot with same confirmation page with different query strings appended

As always, I appreciate you reading this blog post. If you found it helpful, feel free to comment below and/or share it. If you have questions, feel free to ask away. I will answer any question that I know the answer to.

Leave a Comment





This site uses Akismet to reduce spam. Learn how your comment data is processed.