How to Create UTM Codes in Google Analytics
Dumping money into marketing campaigns without knowing which ones are working is like driving with your eyes closed. You might be moving, but you have no idea if you're headed in the right direction. This is where UTM codes come in - they act as GPS trackers for your marketing links, telling you exactly where your website traffic is coming from and what campaigns are driving it. In this guide, we'll walk you through exactly what UTM codes are, how to create them, and how to use them to make smarter marketing decisions.
So, What Exactly Are UTM Codes?
UTM stands for “Urchin Tracking Module.” Urchin was the software company that Google acquired back in 2005 to create Google Analytics, and the name just stuck. In simple terms, UTM codes are small bits of text added to the end of a URL that help you track the effectiveness of your digital marketing campaigns.
You’ve probably clicked on one without even realizing it. A regular URL might look like this:
https://www.yourstore.com/products/summer-shorts
A URL with UTM codes, however, will look a bit longer and more complex:
https://www.yourstore.com/products/summer-shorts?utm_source=facebook&utm_medium=cpc&utm_campaign=summer_sale_2024&utm_content=video_ad
That extra string of text after the question mark tells Google Analytics a detailed story about where this visitor came from. Instead of just seeing "facebook.com" in your reports, you can now see that this person came specifically from a paid ad (cpc) on Facebook as part of your summer_sale_2024 campaign, and they clicked on the video_ad version.
Without UTMs, your analytics data is vague. You might know traffic came from email, but you won't know if it was from your weekly newsletter, a special promo email, or the abandoned cart series. UTM codes provide the specific details you need to measure ROI accurately.
The 5 UTM Parameters Explained
A UTM-tagged URL is built using five potential parameters. Three are required, and two are optional but incredibly useful for getting granular insights. Let's break down each one.
1. Campaign Source (utm_source) - Required
This is the "who" sending you the traffic. It identifies the specific platform, or source, where the link was placed. Think of it as the website or reference platform that directed the visitor to your site.
- Examples:
google,facebook,linkedin,email_newsletter,bing,tiktok
Example in use: utm_source=facebook
2. Campaign Medium (utm_medium) - Required
This is the "how" the traffic got to you. It describes the marketing channel or medium you used. A single source can have multiple mediums.
- Examples:
cpc(cost-per-click),social,paid_social,email,affiliate,display
Example in use: utm_medium=paid_social
Pro Tip: Pairing utm_source and utm_medium gives you a crystal-clear picture. utm_source=facebook & utm_medium=paid_social tells you it was from a paid ad on Facebook, while utm_source=facebook & utm_medium=organic_social tells you it was from a free post on your page.
3. Campaign Name (utm_campaign) - Required
This is the "why" you created the link. It identifies a specific campaign, promotion, or initiative you’re running. This is where you can be very descriptive to help you group related marketing efforts together.
- Examples:
summer_sale_2024,q4_promo,new_product_launch,webinar_signup
Example in use: utm_campaign=summer_sale_2024
4. Campaign Content (utm_content) - Optional
This parameter is used to differentiate between links that point to the same URL within the single campaign. It’s perfect for A/B testing ads, emails, or call-to-action buttons. For example, if you have two CTA buttons in one newsletter - one in the header and one in the footer - you can track which one gets more clicks.
- Examples:
video_ad,image_ad_blue,header_link,footer_cta_button
Example in use: utm_content=header_link
5. Campaign Term (utm_term) - Optional
This parameter was originally designed for paid search campaigns to track the specific keywords you bid on. While auto-tagging in platforms like Google Ads often handles this automatically, it's still useful for non-Google ad platforms or if you want to track specific search terms manually.
- Examples:
running_shoes,marketing_automation_software
Example in use: utm_term=data_analytics_tools
How to Build Your Own UTM Campaign URLs
Creating these long URLs by hand is a recipe for typos and tracking errors. Thankfully, there are free and easy-to-use tools that do the heavy lifting for you. Google's own Campaign URL Builder is the most popular and straightforward option.
Here’s how to use it step-by-step:
- Open Google’s GA4 Campaign URL Builder.
- Enter Your Website URL: In the first field, paste the full URL of the landing page you want to send traffic to (e.g.,
https://www.yourstore.com/special-offer). - Fill in the Required Parameters: Add your values for
campaign_source,campaign_medium, andcampaign_name. As you type, the tool will automatically start generating your tagged URL at the bottom of the page. - Add Optional Parameters (If Needed): If you’re testing different ad creatives or keywords, fill in the
campaign_contentandcampaign_termfields. - Copy Your New Campaign URL: The builder will create the complete, ready-to-use URL for you. You can copy it directly or use the built-in option to convert it to a short link using Bitly.
Here’s an example of what it looks like filled out:
- Website URL:
https://www.coffeeking.com/gear/new-grinder - campaign_source:
instagram - campaign_medium:
paid_social - campaign_name:
grinder_launch_apr24 - campaign_content:
story_link_sticker
The resulting URL will automatically be generated as:
https://www.coffeeking.com/gear/new-grinder?utm_source=instagram&utm_medium=paid_social&utm_campaign=grinder_launch_apr24&utm_content=story_link_sticker
That's the link you'd use in your Instagram story to perfectly track every click.
Best Practices for Flawless UTM Tagging
Now that you know how to build the codes, let's cover a few critical rules to ensure your data stays clean, accurate, and easy to analyze.
- Be Consistent With Naming Conventions: Google Analytics is case-sensitive. This means
Facebook,facebook, andFBwill all be tracked as three different sources. Create a spreadsheet with your team's naming conventions and stick to it. This prevents your data from getting fragmented and messy. - Always Use Lowercase: To avoid the case-sensitivity issue entirely, make it a rule to only use lowercase letters in your UTM tags. It’s a simple habit that will save you headaches down the line.
- Use Underscores or Dashes, Not Spaces: Spaces in URLs get converted into awkward character strings like
%20, making them hard to read. Use dashes (-) or underscores (_) instead. For example, usespring_promoinstead ofspring promo. - Keep Your Tags Simple and Readable: The goal is to understand your reports at a glance. Make your campaign names descriptive but concise.
fall_sale_25_offis much better thanthisfallssaleeventwherewearegivingeveryone25percentoff. - NEVER Use UTMs for Internal Links: This is a cardinal rule. Tagging links from one page of your website to another (e.g., a link on your homepage to your blog) will overwrite the original source data for that visitor. If someone arrived from a Google search and then clicks an internal UTM-tagged link, their session will restart, and their source will be reported as whatever you put in the UTMs, not "Google." This completely corrupts your attribution data.
Where to See Your UTM Campaign Data in GA4
You’ve tagged your links and launched your campaigns. Now, where do you find this precious data in Google Analytics 4?
- Log in to your Google Analytics 4 property.
- On the left-hand navigation menu, click on Reports.
- Under the Life cycle section, go to Acquisition > Traffic acquisition.
- By default, this report is often grouped by Session default channel group. To see your UTM tags, click the small downward arrow next to this primary dimension.
- In the menu that appears, select Session campaign to see a list of all your campaigns. You can also choose Session source / medium to see the source/medium pairs you created.
- For more detail, click the "+" icon next to the primary dimension to add a secondary dimension like Session content or Session keyword term.
Now, you'll see a clean report of your campaigns, allowing you to compare which efforts are driving the most sessions, engaged users, and conversions. You can finally prove which Instagram stories are driving sales and which email newsletters are generating leads.
Final Thoughts
Properly using UTM codes moves you from guesswork to data-backed strategy. They provide the clarity needed to optimize your marketing spend, focus on high-performing channels, and truly understand how customers find your business. It's a foundational skill for any modern marketer.
Getting your campaign data organized with UTMs is a huge step, but the challenge often lies in connecting it with performance data from all your other platforms. That's where Graphed comes in. We make it easy to see the full picture by connecting your Google Analytics, ad platforms like Facebook Ads and Google Ads, e-commerce data from Shopify, and CRM data from HubSpot or Salesforce all in one place. You can leave the complex report building behind and simply ask questions in plain English like, "Show me a dashboard of my top-performing GA4 campaigns by revenue." It turns hours of manual data wrangling into a 30-second conversation, letting you act on insights instead of just digging for them.
Related Articles
How to Connect Facebook to Google Data Studio: The Complete Guide for 2026
Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.
Appsflyer vs Mixpanel: Complete 2026 Comparison Guide
The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.
DashThis vs AgencyAnalytics: The Ultimate Comparison Guide for Marketing Agencies
When it comes to choosing the right marketing reporting platform, agencies often find themselves torn between two industry leaders: DashThis and AgencyAnalytics. Both platforms promise to streamline reporting, save time, and impress clients with stunning visualizations. But which one truly delivers on these promises?