UTM Codes: How to Create UTM Tracking URLs on Google Analytics

Download Now: Free UTM Link Generator
Ginny Mineo
Ginny Mineo


How do you know if Facebook is a worthy investment or if you’re getting enough traffic from your recent promotional campaign? The answer: UTM tracking links.

utm tracking codes; marketer working on utm code

UTM codes help you track where traffic is coming from, allowing you to properly measure each campaign’s, platform’s, or medium’s ROI.

Download Now: Free UTM Link Generator

In this blog post, I will take you through what UTM codes are, how to use them, and how to build them in both Google Analytics and HubSpot.

Table of Contents

Free UTM Link Generator

Create and organize UTM tracking links in this simple, easy-to-use spreadsheet template.

  • Definitions of each parameter type
  • Overview of when and how to use UTMs
  • Best practices for UTM tracking
  • Template to generate your own UTM tracking links
Learn more

    Download Free

    All fields are required.

    You're all set!

    Click this link to access this resource at any time.

    UTM codes are also known as UTM parameters — or tracking tags — because they help you "track" website traffic from its origin. Marketers customize this text to match the web page on which the tagged URL is linked in order to attribute the success of that campaign to specific pieces of content.

    Below is an example of a UTM code attached to the URL of a blog post. (UTM code highlighted in yellow.)

    what is UTM, Hubspot blog URL with a UTM code

    Image Source

    Now, you might be thinking, "I have HubSpot, so I already know if my website traffic is coming from Google, email, social media, and similar marketing channels. What does a UTM code tell me that I don't already know?"

    While HubSpot Marketing Hub provides you with these high-level sources of traffic, UTM helps you drill down into specific pages and posts within these traffic sources.

    If you're promoting a campaign on social media, for example, you'll know how much traffic comes from social media. Building a UTM code, however, can tell you how much of that traffic came from Facebook or even a particular post on Facebook.

    Let me explain in-depth what a UTM code is with an example. Here's a URL with its own UTM code:

    http://blog.hubspot.com/9-reasons-you-cant-resist-list?utm_campaign=blog_post &utm_medium=social&utm_source=facebook

    Let’s break this link down.

    • http://blog.hubspot.com/9-reasons-you-cant-resist-list: This is the base URL of the page.
    • ?: This signals to your analytics software that a string of UTM parameters will follow.
    • utm_campaign=blog_post: This is the first UTM parameter, specifically for the campaign the visitor engaged with (in this case, a blog post campaign).
    • &: This denotes that another UTM parameter will follow.
    • utm_medium=social: This is the second parameter, specifically for the channel the visitor came from (in this case, social).
    • utm_source=facebook: This is the last parameter, specifically for the website the visitor came from (in this case, Facebook).

    In the example above, you're saying that once traffic comes in from people who click this link, the traffic should be attributed to Facebook. The "medium" is social media, while the "source" is Facebook.

    Adding these snippets of code after the question mark above doesn't affect anything on the page — it just lets your analytics program know that someone arrived through a certain source inside an overall marketing channel as part of a specific campaign.

    Now, let's take a closer look at the definition of UTM tracking and discuss the above-mentioned UTM parameters in detail.

    Different UTM Parameters

    Here are the five things you can track with UTM codes and why you might track them.

    1. Campaign

    Campaign-based tracking tags group all the content from one campaign in your analytics. The example UTM code below would help you attribute website traffic to links that were placed as a part of a 20% discount promotion you're hosting.

    Example: utm_campaign=20_off

    2. Source

    A source-based URL parameter can tell you which website is sending you traffic. You could add the example code below to every link you post to your Facebook page, helping you track all traffic that comes from Facebook.

    Example: utm_source=facebook

    3. Medium

    This type of tracking tag informs you of the medium that your tracked link is featured in. You can use the example UTM code below to track all traffic that comes from social media (as opposed to other mediums, like email).

    Example: utm_medium=social_media

    4. Piece of Content

    This type of UTM code is used to track the specific types of content that point to the same destination from a common source and medium.
    It's often used in pay-per-click (PPC) campaigns or with two identical links on the same page, as shown in the sample UTM code below.

    Example: utm_content=sidebar_link or utm_content=header_link

    5. Term

    A term- or keyword-based tracking code identifies the keywords you've paid for in a PPC ad. If you pay for a Google Ads campaign to rank under the keyword "marketing software," you might add the following UTM code to the end of the link you submit to Google to run this ad.

    Example: utm_term=marketing+software

    The best part about UTM parameters is that you can make any combination you like of these codes — use the bare minimum (campaign, source, and medium) to track all of your links, or use all of them to get super specific about your tracking.

    UTM tracking codes can basically help you determine:

    • Where the traffic is coming from: Source.
    • Which general channel the traffic come from: Medium.
    • What type of content people click on: Content.
    • Which term they use to access the page: Term.

    Benefits of UTM Codes

    Crucial aspects of being a great marketer are being able to measure your campaigns' success and impact. Here is how building UTM codes can help you do that:

    • Better tracking. UTM codes allow you to track exactly where your website traffic is coming from, so you can see which marketing tactics are actually driving results. With UTM codes, you can see which sources, mediums, and campaigns are bringing in the most traffic, leads, and sales.
    • More accurate attribution. UTM codes also allow you to give credit where credit is due. For example, if a visitor first finds your website through a Google search and then comes back later through a Facebook ad, you can see the entire customer journey and attribute the sale or conversion to both channels.

    Okay, so you're on board with UTM codes and their benefits... but how the heck do you set them up? Well, let me explain.

    Below are instructions for setting up and measuring UTM parameters in Google Analytics and HubSpot.

    Free UTM Link Generator

    Create and organize UTM tracking links in this simple, easy-to-use spreadsheet template.

    • Definitions of each parameter type
    • Overview of when and how to use UTMs
    • Best practices for UTM tracking
    • Template to generate your own UTM tracking links
    Learn more

      Download Free

      All fields are required.

      You're all set!

      Click this link to access this resource at any time.

      How to Build UTM Codes in Google Analytics

      Here are the steps involved in building UTM codes in Google Analytics.

      1. Open Google's Campaign URL Builder.

      There are three different types of tracking tags you can create in Google, two of which help you track traffic to new apps on app marketplaces. You'll be using the Google Analytics Campaign URL Builder — the third option on this list.

      2. Fill in each link attribute in the following form.

      Visit the page linked above and click the link to see this URL builder. Then, you'll see the UTM builder shown below. Add the URL, Campaign, Source, and Medium information into their respective boxes.

      what is utm, how to build utm codes google analytics:  fill out the form

      3. Use the link in your marketing campaign.

      If you'd like to shorten it, you'll need a tool like bit.ly ... or just use HubSpot's URL Builder if you're a HubSpot customer.

      4. Measure your success.

      If you already have Google Analytics set up for your site, Google will automatically track incoming campaigns. Like in HubSpot, you can access them under "Audience," then "Sources," then "Campaigns." Click on each campaign to view the source and medium.

      how to build utm codes google analytics: view campaigns

      And that's it — you'll have custom tracking codes set up and running in no time! In a few weeks, you'll be able to make a case for what you need because you'll have the right metrics available.

      How to Build UTM Codes in HubSpot

      Now, let's see how you can build UTM codes in HubSpot. I personally prefer Hubspot over Google Analytics as it offers vivid features to track your UTM codes. Aside from letting you know which marketing campaigns drive the most website traffic, HubSpot’s analytics tool also zooms in on the campaigns themselves.

      For example, you can generate reports covering your email or social media performance, which gives you a unified overview of the customer journey from beginning to end. 

      1. Navigate to your Analytics Tools.

      In your Marketing Hub dashboard, select "Reports" on the top navigation bar. Then select "Analytics Tools" in the dropdown, as shown below.

      How to Build UTM Codes in HubSpot: navigate to your analytics tool

      2. Open the Tracking URL Builder.

      In the menu of analytics tools that appears, look to the very bottom right corner. You'll see the option "Tracking URL Builder." Click this option at the bottom of the page, as shown in the red box below.

      How to Build UTM Codes in HubSpot: open the tracking url builder

      3. Open the Tracking URL form to create a new UTM code.

      Whenever you create a web campaign that includes at least one UTM code, you'll see this campaign listed on the page shown below.

      This page outlines a tracking tag's source, medium, term, content, and creation date, which you can see along the bottom of the screenshot below. Click "Create Tracking URL" in the top right corner.

      How to Build UTM Codes in HubSpot: open the tracking URL form to create a new UTM code

      4. Fill in each attribute of your UTM code and click "Create."

      In the form that appears, fill in the URL, Campaign, Source, and Medium fields. If you'd like to add Content and Term, you can do so in the bottom two fields of this form. When you're done, you'll see an orange "Create" button become available at the bottom.

      Click it, and HubSpot will log your UTM code as a new campaign. This link will be ready to use on any web page from which you want to track the traffic.

      How to Build UTM Codes in HubSpot: fill in the attributes of your UTM code and click create5. Use the shortened link in your marketing campaign.

      HubSpot automatically generates a shortened URL, which is better to use when promoting your tracked content.

      How to Build UTM Codes in HubSpot: use the shortened link in your marketing campaign

      6. Measure your success.

      You can track your UTM parameters in your Traffic Analytics dashboard under "Other Campaigns," as shown below. Click on the individual campaign to break down the source and medium.

      what is utm, How to Build UTM Codes in HubSpot: measure your success

      As you can see in the second image (below), the name of the campaign appears to the left — based on the text in the UTM code you created — with the traffic from people who used each URL to arrive at your campaign's main web page.

      How to Build UTM Codes in HubSpot: measure your success

      Now that you know how to set up UTM links, how do you use them? Let’s take a look.

      How to Use UTM Links for Your Campaigns

      You can use a combination of UTM codes and parameters in a lot of ways. Here’s how you can use them in your day-to-day as a marketer.

      1. Track the success of a promotional campaign.

      Dropping product prices or launching a new product can be daunting. Plus, if there’s no measurable ROI, it’ll be a wasted effort. Luckily, you can tell whether users are effectively arriving at your site from your promotional efforts using UTM codes.

      Here’s one example for a product launch:


      Or, if you’re running a discount campaign through Instagram influencers, here’s what a UTM link can look like:


      2. See how well your social channels promote your content versus when your followers promote your content.

      How do your organic social efforts stack up against your followers’ promotional efforts? You can create two UTM campaigns to find out.

      For your own posts, you can share a link as follows:


      Then, prompt your followers to share the word about you, but let them share the following link:


      3. Measure the effectiveness of guest posting referral traffic.

      If you’re guest posting on several industry websites like me, it’s essential to know whether those posts are driving traffic to your site.

      Whenever you create a guest post for another publisher, ensure all the links pointing to your website on that post have UTM parameters that tell you where the traffic came from. Here’s one example:


      4. Track the same piece of content across multiple marketing channels.

      In my experience, this is probably one of the most useful ways to use UTM tracking codes: Creating different ones for the same piece of content, and using it across different platforms. You can drop the campaign parameter for this use case and simply track the medium, source, and content.

      Let’s say you want to track referral traffic from a video you posted on LinkedIn, YouTube, and Facebook. Here are the three different links you could use:

      • LinkedIn: mywebsite.com/my-content?utm_medium=social&utm_source=linkedin&utm_content=caption
      • YouTube: mywebsite.com/my-content?utm_medium=social&utm_source=youtube&utm_content=description
      • Facebook: mywebsite.com/my-content?utm_medium=social&utm_source=facebook&utm_content=caption

      5. See where most people click on your internal links in a blog post.

      As an SEO content writer, knowing if the internal linking strategy is working as intended is very important. Adding UTM parameters helps me track where my content gets the most clicks. Here are three examples:

      • Image: mywebsite.com/my-content?utm_source=blog&utm_content=image
      • Above the Fold: mywebsite.com/my-content?utm_source=blog&utm_content=above_the_fold
      • Bottom of the Post: mywebsite.com/my-content?utm_source=blog&utm_content=bottom

      Note: I advise you to use this strategy with caution, as using too many UTM parameters in internal links can cause confusion to Google. You should use it on a small batch of internal links, collect the clicking patterns, delete the UTM links, and then act on those results for your future internal linking efforts.

      As always, ensure that you’ve set a canonical URL for each link to minimize confusion and prevent duplicate indexing.

      Free UTM Link Generator

      Create and organize UTM tracking links in this simple, easy-to-use spreadsheet template.

      • Definitions of each parameter type
      • Overview of when and how to use UTMs
      • Best practices for UTM tracking
      • Template to generate your own UTM tracking links
      Learn more

        Download Free

        All fields are required.

        You're all set!

        Click this link to access this resource at any time.

        UTM Tracking Best Practices

        UTM tracking URLs are a powerful marketing tool, but to get the most out of them, it's important to follow some best practices. Here are a few tips to keep in mind.

        1. Create consistent UTM tracking codes.

        Make sure your URLs and links are consistent, clean, and easy to read. I’d even recommend creating a standard for link tagging, or a UTM parameter guide (kind of like a brand style guide) to ensure consistency across platforms and campaigns.

        For example, for monthly newsletters, you might choose to always input the "utm_medium=email” in the medium parameter and use the “utm_campaign=monthly_newsletters” in the campaign parameter.

        Then, for all Facebook posts, you would always use “utm_medium=social” in the medium parameter and “utm_source=facebook” in the source parameter.

        By using the same UTM parameters for similar campaigns, you can ensure that all data is accurate and easy to analyze when it’s time to calculate your ROI and put together marketing reports. This allows you to make data-driven decisions about which campaigns are most effective.

        2. Capitalize your UTM codes carefully, or not at all.

        UTM codes are case-sensitive, so stick with either all lowercase or uppercase. Lowercase is easier to remember. That way, you don’t have to wonder whether only the first letter or the whole parameter is capitalized.

        By sticking to consistent capitalization, you’ll avoid annoying discrepancies in your website analytics. Inconsistent capitalization can create duplicate entries or split data across different channels, making your data difficult to analyze.

        3. Keep names short but descriptive.

        When creating UTM parameters, make the names short but descriptive. This will make your UTM codes easier to read and remember. They will also take up less space in blog posts and social media updates, ultimately making the links look clean, attractive, and professional.

        However, the most important benefit is that you can avoid any confusion or mix-ups between campaigns with similar names. Clear and concise UTM codes can make it easier to differentiate between similar campaigns, which is especially critical if your team runs a large volume.

        For instance, let's say you're launching a new ebook as part of an email marketing campaign. A short but descriptive UTM code for this campaign might look like this:


        4. Keep a running list of your UTM links in an accessible location.

        Creating yet another spreadsheet may make you cringe, but hunting down a wide variety of UTM-tracked links is what’s sure to give you a headache. Keep a list of your UTM links so everyone on your team knows which tagged links currently exist.

        Having a running list will also prevent your team from creating duplicate UTM codes for the same campaign, which can skew your analytics data and create unnecessary confusion. With a running list, everyone on your team will have an easy reference point to ensure they are using the correct UTM codes for new campaigns.

        5. Connect UTM tracking codes to your CRM or marketing tool.

        Adding your UTM tracking URLs to your CRM or marketing tool is essential. (If you’re not sure of what that can look like, here’s an example of how to do it in HubSpot.) By doing so, you’ll be able to better understand the customer journey, accurately attribute sales and conversions, and make decisions based on data.

        Start Creating UTM Tracking URLs

        Use the steps, best practices, and tools above to start creating and using UTM tracking URLs so you're able to track the performance of your marketing campaigns and content. That way, you can reliably boost your metrics and improve the ROI of your digital marketing strategy.

        Editor's note: This post was originally published in September 2013 and has been updated for comprehensiveness.

        New call-to-action

        Related Articles

        Create and organize UTM tracking links in this simple, easy-to-use spreadsheet template.

          Marketing software that helps you drive revenue, save time and resources, and measure and optimize your investments — all on one easy-to-use platform