You can save time and reduce errors by using Google Tag Manager to automate campaign tagging for social media posts. Learn below (I’ve even included a 5-min step-by-step video tutorial!) how you can add URL fragments such as “#fb” to links instead of creating campaign URLs from scratch.
“If you don’t tag it, you can’t track it.”
When I saw these words on the screen in Karine Joly’s session at the 2017 eduWeb Digital Summit in Boston, it immediately sparked the idea for this post.
I love tracking, but I don’t enjoy tagging.
What about you? Not sure?
Tagging is the process of adding Google Analytics campaign parameters to URLs so we can measure, or track, whether or not the marketing channels and messages we use help to achieve our goals (what’s not to love about this part, right?).
We should always create campaign URLs for ALL the links pointing to our site that we share on social media.
Creating the URLs isn’t difficult, but it’s an extra step. And, this extra step can become cumbersome when you post a lot on social media.
The manual tagging process is also prone to error, particularly if you’re relying on others to create these tagged links. Luckily, there’s a way to simplify this process when you repeatedly use the same campaign parameters.
Google Tag Manager (GTM) to the rescue!
During Karine’s conference presentation about the Higher Ed Digital Marketing Analytics Roadmap, her call to tag links reminded me of something I’d learned in the Higher Ed Experts Advanced Web Analytics course.
Using Google Tag Manager (GTM), I could automate campaign tagging, so my social media manager would no longer have to create a campaign URL for each and every post she makes to Facebook, Twitter, and Linkedin. Instead, all she would have to do is add a URL fragment, such as #fb, #tw, or #li, to the end of the link and the campaign variables that I pre-determined would automatically be logged in Google Analytics.
It saves her time and improves the quality of our data. WIN-WIN!
On the train ride home from Boston to Maine, I drew upon resources from my Higher Ed Experts class and began my work in GTM. By the time I arrived, it was ready to go and I couldn’t wait to share the good news with my social media manager.
How to automate and shorten campaign URLs with GTM in 4 steps
The following instructions provide a basic overview on how to create simple campaign URLs with URL fragments in GTM.
Remember, you must have implemented the GTM tracking code on your site and have access to GTM (or someone who does).
Login to GTM and create a new User-Defined Variable with the following settings.
Variable name: URL – Fragment
Next you’ll create three more User-Defined Variables – one for each campaign parameter (source, medium, and campaign name). The “Input” is the fragment you will add to the end of your URLs (e.g. #fb) for the campaign parameters you want used. For example, the input “fb” means that when you add #fb to the end of your URL, it will append the following campaign parameters: utm_source=facebook, utm_medium=social, and utm_campaign=myorg-facebook.
Variable name: Lookup – URL – fragment – source
Variable name: Lookup – URL – fragment – medium
Variable name: Lookup – URL – fragment – campaign name
The third step is to send the output from the previous Lookup Table variables into Google Analytics. Do this using the Universal Analytics Page View tag you already have configured in your GTM container.
The final step is testing. Enable the “Preview Mode” in GTM and load your webpage with one of your fragments appended (e.g. http://yourdomain.com/#fb). Using GTM’s Preview Mode, look through the Variables menu within the Page View tag to see your variables firing. Publish your changes and conduct additional testing to confirm campaign data is being recorded in Google Analytics.
The 5-minute video tutorial
If you need even more detailed instructions on this process, you can also review this useful article.
Wait, don’t go yet: important things to remember
- The best use of this process is when you’ll be using the same campaign parameters over and over again, such as social media posts that consistently use the same source, medium, and campaign name.
- There may be times when you share links on social media that are a part of a different campaign, so you’ll need to create a different campaign URL. Think before you post!
- If you’re using URL shorteners, such as bit.ly, remember to add the URL fragment (e.g. #fb) before shortening the URL.
- If you’re linking to a page on your website that isn’t yet upgraded to GTM, then this process won’t work. You’ll still need to create and post the full campaign URL.
- URL fragments have many other uses, such as for custom dimensions or simply hiding the campaign parameters. Once you’ve got the hang of how they work, consider other ways you can employ them.
Meet the Faculty: Holly Sherburne
Higher Ed Experts is a professional online school for digital professionals working in universities and colleges.
When you take a professional certificate course with us, you get a chance to upgrade your skills by working on your projects, interacting with classmates just like you and getting detailed personalized feedback from your instructor.
Holly Sherburne is the Director of Social Media and Digital at Bowdoin College. Her team works with departments and programs college-wide to facilitate the integration and adoption of digital media and technology to achieve a more connected, engaged, and informed campus community. Goal-setting, strategy, analytics and training are a daily part of her work.
Holly has earned her Google Analytics Qualification and is a member of the Digital Analytics Association.
She has a Master’s degree in Environmental Health Science from Oregon State University. She is also a graduate of Higher Ed Experts’ Social Media Measurement and as well as the Web Analytics, Advanced and Predictive Analytics professional certificate programs.
Holly Sherburne teaches Higher Ed Expert’s 4-week online course on Social Media Measurement for Higher Education.Tags: Higher Ed Experts Faculty, Higher Ed News