Create unique URLs with GTM for tracking Google Analytics destination goalsPosted by On

Create unique URLs with GTM

Destination goals in Google Analytics are great when your aim is to direct your visitors to a particular page (usually a thank you or a confirmation page). Unfortunately, it can get a little more complicated when you have the same destination URL for two different user journeys. You can create unique URLs with GTM to set up distinct Google Analytics destination goals.

One example is when a user can access that destination page via different website journeys. Imagine that you have a generic thank you page and visitors are driven there when they sign up for a newsletter… but also when they fill out a contact form. Another situation may be when you want to track user registration goals from a checkout page but once the user signs up, they are taken back to the same checkout page. You may not always have the power to make website development changes to create unique URLs for these different scenarios.

Another example is when a user is able to bookmark a thank you page and start a new session with it. You may want to exclude these visits from your goal conversions.

You might expect the funnel functionality in Google Analytics to narrow down these user paths. Unfortunately, this feature only affects the Funnel Visualisation report. Your conversion rate will still be calculated based on the total number of sessions where your destination page was viewed.

Google Tag Manager offers a great solution to these problems where you can change the URLs that are sent to Google Analytics based on the different journeys that your visitors took.

Define the page to make unique

The first step is to create a trigger that defines the exact criteria for your scenario. For this, you want to create a Page View trigger that defines your Page Path and also the Referrer (the previous page visited in your desired user journey).

Note that your Page Path will start with a forward slash and your Referrer will be the full URL.

GTM trigger for unique URLs

If you are unsure what the exact link to your page was, head to the preview mode and check the exact Referrer value in the variables section.

GTM Referrer variable

Create a tag to overwrite Page Path

Next, add the tag that will rewrite the Page Path before sending it to Google Analytics.┬áThis is a Page View tag where you configure Fields to Set and attach the trigger configured above. If you’re using a Settings variable (which you should do!), tick “Enable overriding settings in this tag” to get the Fields to Set options. Add a “page” field and input your new path name that you’ll want to see in GA.

GTM new virtual page view tag

Amend your Base Page View tag

Finally, you need to amend your existing Base Page View tag where you add the same trigger from first step as the exception. This will ensure that you don’t have duplicate hits on for that same page – one with the old URL and one with the new one.

GTM page view tag

Create your Destination Goals

Once all your GTM work is complete and you’ve published your container, head to Google to define your new destination goal. Now you can use your new page view path as the goal destination.

Google Analytics destination goal


Splitting up your destination goals in the way described above will make your Google Analytics reports much more meaningful and precise. Your goals should help you find out exactly what different users of your site find relevant. You should also want to find out how different goals influence one another. When you don’t have the power to make development changes, often the tactic of renaming page paths will be very effective.

Conversion Rate Optimisation


Agata AdamiakAuthor posts

Agata is the director of Business Ahead. She began her digital marketing journey in 2008. She cut her digital teeth on programming - designing Wordpress websites for small businesses. She also worked as an in-house marketeer for eight years, creating and developing a digital marketing strategy for a small business that thrived under her marketing leadership. She then joined the corporate world, specialising as a digital marketing analyst for the global printer manufacturer Brother. Agata is passionate about using marketing strategy and in particular SEO and CRO to exceed business goals. She uses digital marketing techniques to let growing companies find new clients, serve existing clients better and to generate more profit for themselves in the process. With a degree in MSc IT for Supply Chan Management from Kingston University (awarded distinction), Agata's experience is backed up by academic knowledge. She lives and works in Manchester, UK.