Mind, Body & Soul
Terpenes vs Essential Oils in Aromatherapy
05 August 2021
Ways to Make Your Backyard More Relaxing
03 August 2021
Fur, Fins & Feathers
Tips To Make Your Anxious Cat Happy
29 July 2021
Mind, Body & Soul
CBD for Insomnia: Can It Help?
27 July 2021
Trending Music Hashtags To Get Your Posts Noticed
24 August 2018
Trending Fashion Hashtags To Get Your Posts Noticed
05 April 2018
Trending Wedding Hashtags To Get Your Posts Noticed
18 September 2018
Trending Beauty Hashtags To Get Your Posts Noticed
05 July 2018
How To Use GTM To Rename URLs & Page Titles in Google Analytics
Digital marketing is all about data and insights. If you cannot accurately evaluate and measure results, you will never know how to improve which will eventually catch up to you and leave room for your competition outperform you in critical areas. Which is why data scientists and data analyst positions have become such converted roles as they help weed through the mountain of data to find key insights.
One of the main reasons data analysis isn't always as useful as it should be is due to the input of dirty data. Depending on the seriousness of the crime it can take months to clean up a reasonable amount of data to pull out any relevant trends and even then you're dealing with a smaller sample due to the cleanup.
Since Google Analytics is usually the tracking tool of choice, the usual dirty data culprit in this tool is the recording of poorly structured or non-descriptive URLs and even in some cases page titles too. There are very few websites that give their URL structure much thought, and it naturally hurts them when it comes to reporting with Google Analytics.
Reporting tends to suffer from poor URL structure
Usually, sites who are committed to change often have to bite the bullet and revamp their entire URL structure or require dev for URL rewrites which often means SEO needs to get involved with a URL clean up which can get messy.
Thankfully Google has realised that sites don't always consider SEO and URL best practices when creating a website, so they've given us the option of rewriting URLs in Google Tag Manager.
Why would you want to rewrite your URLs
There are many reasons you may want to revise your URL's, and all of them stem from CMS limitations. No CMS is perfect, and neither is their ULR structures especially when you weren't the one to plan out the URL structure from the beginning.
Your URL's and subfolders may not reflect the way your content is hosted, or you may be running encoded URLs, which can well cause pain for any digital marketer trying to extract reports.
Secondly, Google Analytics is a page view tool by nature and it simply basis it's tracking each time a traditional URL is loaded into the browser, so it may not always be suited to how you want to structure your data or your reporting.
Popular reasons why you would rewrite your URLs
- URLs are not descriptive
- URLs are encoded
- URL's have a poor structure or no apparent structure
- URL's don't change as with Angular JS and React JS front ends
How to rewrite your URLs with GTM
- Head over to Google Tag Manager
- Create a new tag by clicking "NEW."
- Provide a name for your tag IE - Blog Search URL Rewrite
- Select Google Analytics - Universal Analytics Tag
- Set Track Type to "Page View"
- Check the box that says "Enable overriding setting sin this tag."
- Include your Google Analytics tracking ID
- Click on the drop-down menu that says "More Settings."
- Then click on the drop-down menu that says "Fields to Set."
- Under field name select page
- Add the URL structure you want as a rewrite
- Click "Add Field"
- Select the filed name title
- Add the title structure you would like to see in google analytics
- Set your trigger
- Click save & publish
Note: This will affect your page view count by adding a duplicate pageview to your account, so if this bothers you, you may need to add an additional step to not fire your standard pageview tag on those affected URLs.
I personally don't mind since they can always be filtered out in reporting with a simple Regex filter.
Protip! This workaround is ideal for complex search URLs and making sure Google understands and captures all internal search queries performed on your site. We currently use it on nichemarket and it works really well.
Rewrite the wrongs of the past
Now that you can accurately categorise your data in Google Analytics it will become a pleasure to work through. Whether you're running reports in Data Studios, third-party tools or merely good old excel.
Making sure your data is cleaner will save you so much time and help you gain better insight into how users navigate and use your website.