The Magic of UTM Parameters

The Magic of UTM Parameters
Learn how UTM parameters helped me track exactly where my course students came from. Complete guide with real examples, best practices, and PostHog integration for deeper insights.
Mohammad Alhabil
Author
The Magic of UTM Parameters: How I Discovered Exactly Where My Course Students Came From 🎯
A few days ago, while preparing to launch my new training course, I shared the registration link everywhere—Facebook, Instagram, LinkedIn, email newsletters, and more. Then I asked myself a simple but critical question: If 100 people register, how will I know which platform was the strongest? Which specific post actually drove the signups?
That's when I discovered the world of UTM parameters, and it completely changed how I track marketing performance.
What Are UTM Parameters?
UTM stands for Urchin Tracking Module, named after Urchin, a web analytics platform Google acquired in 2005. Simply put, UTM parameters are identification tags you add to the end of a URL that don't affect how the link works, but tell analytics tools exactly where your traffic came from.
Think of them as digital name tags for your links—invisible to users, but incredibly valuable for tracking.
How UTM Parameters Work
When someone clicks a link with UTM parameters, analytics platforms like Google Analytics 4 capture those parameters and attribute the session to the correct source, medium, and campaign. This enables detailed reporting on exactly which marketing efforts are driving results.
Example URL with UTM Parameters:
https://yoursite.com/course-registration?utm_source=linkedin&utm_medium=social&utm_campaign=course_launch_2025
The part after the ? is what makes the magic happen.
The Five Core UTM Parameters
There are five standard UTM parameters you can use to track your campaigns. You don't need to use all five every time, but understanding each one helps you build a complete picture of your traffic.
1. utm_source — The Traffic Source
What it tracks: The platform or tool where the link appears (the "who" or "what" that sent the visitor).
Examples:
utm_source=facebook
utm_source=linkedin
utm_source=google
utm_source=newsletter
utm_source=instagram
Use case: Identify which platform is driving the most traffic to your landing page.
https://yoursite.com/course?utm_source=facebook
https://yoursite.com/course?utm_source=linkedin
https://yoursite.com/course?utm_source=newsletter
2. utm_medium — The Marketing Medium
What it tracks: The channel type or method by which the link is shared.
Examples:
utm_medium=social # Organic social media post
utm_medium=cpc # Cost-per-click ad (paid)
utm_medium=email # Email campaign
utm_medium=bio # Link in bio
utm_medium=referral # Referred from another site
Use case: Differentiate between paid ads and organic posts on the same platform.
# Organic LinkedIn post
https://yoursite.com/course?utm_source=linkedin&utm_medium=social
# Paid LinkedIn ad
https://yoursite.com/course?utm_source=linkedin&utm_medium=cpc
3. utm_campaign — The Campaign Name
What it tracks: The specific campaign or goal this link is part of.
Examples:
utm_campaign=black_friday
utm_campaign=course_launch_january
utm_campaign=summer_sale
utm_campaign=early_bird_discount
Use case: Compare performance across different campaigns or promotions.
# Early bird campaign
https://yoursite.com/course?utm_source=facebook&utm_medium=social&utm_campaign=early_bird
# Official launch campaign
https://yoursite.com/course?utm_source=facebook&utm_medium=social&utm_campaign=official_launch
4. utm_content — Content Differentiation
What it tracks: Distinguishes between different pieces of content within the same campaign and platform. Perfect for A/B testing to see which creative or message performs better.
Examples:
utm_content=image_post
utm_content=video_post
utm_content=carousel_ad
utm_content=cta_button_blue
utm_content=cta_button_red
Use case: Test which version of your ad or post drives more conversions.
# Image post on Instagram
https://yoursite.com/course?utm_source=instagram&utm_medium=social&utm_campaign=course_launch&utm_content=image_post
# Video post on Instagram
https://yoursite.com/course?utm_source=instagram&utm_medium=social&utm_campaign=course_launch&utm_content=video_post
5. utm_term — Keyword Tracking
What it tracks: Primarily used in paid search campaigns to identify the specific keyword that triggered your ad.
Examples:
utm_term=marketing_course
utm_term=data_analysis_training
utm_term=web_development_bootcamp
Use case: Measure which paid keywords are driving the most valuable traffic.
# Google Ads campaign targeting "digital marketing course"
https://yoursite.com/course?utm_source=google&utm_medium=cpc&utm_campaign=spring_2025&utm_term=digital_marketing_course
How I Used UTM Parameters for My Course Launch
When I launched my course, I created unique UTM-tagged links for each marketing channel. Here's how I structured them:
LinkedIn Organic Post
https://mycourse.com/register?utm_source=linkedin&utm_medium=social&utm_campaign=course_launch_jan2025&utm_content=announcement_post
LinkedIn Sponsored Ad
https://mycourse.com/register?utm_source=linkedin&utm_medium=cpc&utm_campaign=course_launch_jan2025&utm_content=sponsored_ad
Instagram Story
https://mycourse.com/register?utm_source=instagram&utm_medium=social&utm_campaign=course_launch_jan2025&utm_content=story
Email Newsletter
https://mycourse.com/register?utm_source=newsletter&utm_medium=email&utm_campaign=course_launch_jan2025&utm_content=announcement_email
Facebook Video Post
https://mycourse.com/register?utm_source=facebook&utm_medium=social&utm_campaign=course_launch_jan2025&utm_content=video_post
What I Discovered from the Data
With UTM tracking in place, I could answer questions I never could before:
Which Platform Drove the Most Registrations?
LinkedIn generated 45% of all signups, while Instagram Stories contributed 30%, and email newsletters brought in 15%.
Which Content Format Performed Best?
Video posts on Facebook and Instagram had 3x higher click-through rates than image posts.
Which Campaign Phase Was Most Effective?
The "early bird discount" campaign outperformed the "official launch" campaign by 60% in conversion rate.
Which Medium Had the Highest ROI?
Organic social posts (utm_medium=social) delivered better ROI than paid ads (utm_medium=cpc) for this particular course launch.
The Result?
I stopped posting randomly and started focusing my effort and budget on the platforms and content types that actually generated registrations.
Best Practices for UTM Parameters
Use Consistent Naming Conventions
Always use lowercase letters because analytics platforms are case-sensitive, making "Facebook" and "facebook" two different identifiers.
Good:
utm_source=linkedin
utm_medium=social
utm_campaign=summer_sale
Bad:
utm_source=LinkedIn
utm_medium=Social
utm_campaign=Summer_Sale
Use Underscores or Hyphens (But Be Consistent)
Pick one separator and stick with it across all your campaigns.
Consistent with underscores:
utm_campaign=course_launch_2025
Consistent with hyphens:
utm_campaign=course-launch-2025
Keep It Short and Descriptive
Avoid overly long or vague parameter values.
Good:
utm_campaign=black_friday_2025
Bad:
utm_campaign=this-is-our-amazing-black-friday-sale-campaign-for-2025
Never Use UTMs on Internal Links
Only use UTM parameters on external traffic drivers, not on internal site links, because each new UTM parameter triggers a new session in analytics and can misrepresent your metrics.
Wrong:
<!-- Internal navigation link -->
<a href="/about?utm_source=homepage&utm_medium=nav">About Us</a>
Right:
<!-- Clean internal link -->
<a href="/about">About Us</a>
Create a UTM Tracking Spreadsheet
Maintain a spreadsheet to generate URLs with UTM parameters, track historical campaigns, and ensure consistency across your team.
Spreadsheet columns:
- Campaign Name
- URL Destination
- utm_source
- utm_medium
- utm_campaign
- utm_content
- utm_term
- Full UTM URL
- Short URL (if using a URL shortener)
- Date Created
- Notes
How to Create UTM Links
Method 1: Manual Construction
Start with your destination URL and add parameters:
https://yoursite.com/page
?utm_source=facebook
&utm_medium=social
&utm_campaign=summer_sale
Key rules:
- Start with
?after the main URL - Separate parameters with
& - Use
=to assign values - No spaces (use underscores or hyphens)
Method 2: Use Google's Campaign URL Builder
Google's free Campaign URL Builder is a quick way to create UTM-tagged links for any campaign.
Steps:
- Go to Google Campaign URL Builder
- Enter your website URL
- Fill in the UTM parameters
- Copy the generated URL
Example input:
- Website URL:
https://mycourse.com/register - Campaign Source:
linkedin - Campaign Medium:
social - Campaign Name:
course_launch_2025
Generated URL:
https://mycourse.com/register?utm_source=linkedin&utm_medium=social&utm_campaign=course_launch_2025
Method 3: Use URL Shorteners
Long UTM URLs can look messy, especially on social media. Use URL shorteners like Bitly or Rebrandly to create clean, branded short links that still preserve UTM tracking.
Before:
https://mycourse.com/register?utm_source=instagram&utm_medium=social&utm_campaign=course_launch_2025&utm_content=story
After (with Bitly):
https://bit.ly/mycourse-ig
The UTM data is preserved when the short link redirects to the full URL.
Tracking UTM Data in Google Analytics 4
To analyze UTM data in GA4, navigate to Reports → Acquisition → Traffic acquisition.
View Traffic by Source/Medium
- Go to Reports → Acquisition → Traffic acquisition
- Change the primary dimension to Session source / medium
- You'll see entries like:
facebook / sociallinkedin / cpcnewsletter / email
View Campaign Performance
- In the same report, change the dimension to Session campaign
- You'll see all your campaign names:
course_launch_2025early_bird_discountblack_friday
Add Secondary Dimensions for Deeper Insights
Click the + icon to add secondary dimensions:
- Combine Session campaign with Session source/medium to see which campaigns performed best on each platform
- Add Landing page to see which pages converted best from each source
Introducing PostHog: Taking UTM Tracking to the Next Level
While Google Analytics provides solid UTM tracking, I wanted more granular insights into user behavior after they clicked my links. That's when I discovered PostHog.
What is PostHog?
PostHog is an all-in-one, open-source platform that provides product analytics, web analytics, session replay, feature flags, A/B testing, surveys, and more.
Why I Chose PostHog for My Course
1. Complete User Journey Tracking
PostHog's autocapture automatically tracks every user interaction without manual instrumentation, enabling retroactive analysis. I could see:
- Which UTM source brought a user to my landing page
- How long they spent reading the course details
- Whether they watched the preview video
- At which step they abandoned the registration form
- Which users completed registration
2. Session Replay
Watch real user sessions to diagnose issues and understand user behavior. When I noticed users from LinkedIn ads were dropping off at the payment page, I watched their session recordings and discovered the payment form was confusing on mobile devices.
3. Funnel Analysis
I created a registration funnel:
- Landing page view
- Course details viewed
- Registration form started
- Payment information entered
- Registration completed
PostHog showed me exactly where users from each UTM source were dropping off.
4. Cohort Analysis
I grouped users by UTM source and compared:
- Conversion rates by platform
- Time to conversion by campaign
- Lifetime value by traffic source
5. Native UTM Integration
PostHog automatically captures UTM parameters and makes them available in all reports without extra configuration.
Real Results with PostHog
Discovery 1: Instagram Stories Had High Clicks but Low Conversions
While Instagram Stories drove 30% of clicks, they had the lowest conversion rate (8%). Session replays revealed users were primarily mobile users on-the-go, not in a purchasing mindset.
Action: I adjusted my Instagram strategy to focus on awareness and engagement, directing serious buyers to email signup instead of direct purchase.
Discovery 2: LinkedIn Organic Posts Had the Highest Quality Traffic
LinkedIn organic posts had a 22% conversion rate—nearly 3x higher than any other source. Users from LinkedIn spent an average of 8 minutes on the course page and were 4x more likely to complete registration.
Action: I doubled down on LinkedIn content, posting more educational content and engaging in discussions.
Discovery 3: Email Newsletter Subscribers Converted Fastest
Users from email campaigns completed registration 60% faster than other sources, indicating high intent and trust.
Action: I prioritized building my email list as a long-term strategy.
Complete UTM + PostHog Setup Guide
Step 1: Create Your UTM Links
Use Google's Campaign URL Builder or create them manually:
https://mycourse.com/register?utm_source=linkedin&utm_medium=social&utm_campaign=course_launch&utm_content=post_1
Step 2: Set Up PostHog
Sign up for PostHog Cloud (free tier includes 1 million events/month):
npm install posthog-js
Add PostHog to your site:
// In your main JS file
import posthog from 'posthog-js'
posthog.init('YOUR_PROJECT_API_KEY', {
api_host: 'https://app.posthog.com',
autocapture: true // Automatically track clicks and pageviews
})
Step 3: Create a Conversion Funnel
In PostHog dashboard:
- Go to Insights → Funnels
- Define your funnel steps:
- Step 1: Pageview - Landing Page
- Step 2: Click - "View Course Details"
- Step 3: Click - "Start Registration"
- Step 4: Click - "Complete Payment"
- Add a breakdown by utm_source or utm_campaign
Step 4: Set Up Session Recordings
Enable session recordings to watch how users navigate:
- Go to Settings → Project → Recordings
- Enable "Record user sessions"
- Filter recordings by UTM parameters to watch specific traffic sources
Step 5: Create Custom Dashboards
Build dashboards to monitor:
- Top traffic sources (by UTM)
- Conversion rates by campaign
- User paths from each source
- Session duration by medium
Common UTM Tracking Mistakes to Avoid
Mistake 1: Inconsistent Parameter Values
Using both facebook and Facebook creates separate entries in analytics.
Solution: Create a naming convention document and stick to it.
Mistake 2: Not Tracking Internal Campaigns
Forgetting to add UTMs to email campaigns, partner promotions, or offline QR codes.
Solution: Make UTM creation part of every campaign launch checklist.
Mistake 3: Using Generic Campaign Names
Vague names like campaign1 or promo don't tell you anything useful months later.
Solution: Use descriptive names: black_friday_2025 or spring_course_launch
Mistake 4: Not Shortening Long URLs
Sharing long UTM URLs on social media looks unprofessional and can get truncated.
Solution: Always use a URL shortener for social media posts.
Mistake 5: Forgetting to Test Links
Broken UTM links mean lost tracking data.
Solution: Click every UTM link before publishing and verify it appears correctly in your analytics.
The Bottom Line
UTM parameters and PostHog transformed how I track and optimize my marketing efforts. Instead of guessing which platforms and campaigns worked, I now have concrete data showing:
✅ Exactly where my registrations came from
✅ Which content formats perform best
✅ Where users drop off in the registration process
✅ Which traffic sources have the highest lifetime value
✅ How to allocate my marketing budget effectively
The result? I reduced wasted ad spend by 40%, increased my conversion rate by 25%, and focused my energy on the platforms that actually drive results.
Your Next Steps
- Start with the basics: Add UTM parameters to your next campaign
- Create a tracking spreadsheet: Document every UTM link you create
- Set up PostHog: Get deeper insights beyond basic analytics
- Test and iterate: Use data to optimize your marketing strategy
Further Reading and Tools
UTM Resources
PostHog Resources
- PostHog Official Website
- PostHog Documentation
- PostHog GitHub Repository
- PostHog vs Google Analytics
Analytics Platforms
Coming Next: In my next post, I'll dive deeper into PostHog's advanced features, including how to set up custom events, create powerful cohorts, and use feature flags for gradual rollouts. Stay tuned!
Topics covered
Found this article helpful?
Share it with your network and help others learn too!

Written by Mohammad Alhabil
Frontend Developer & Software Engineer passionate about building beautiful and functional web experiences. I write about React, Next.js, and modern web development.
Related Articles
View all
How I Tracked My Students' Journey with PostHog
Learn how PostHog helped me track student behavior, identify conversion issues, and increase my course conversion rate by 133%. Complete Next.js integration guide with real examples.

Say Goodbye to AI Complexity with TanStack AI! The SDK That Ends Vendor Lock-in
TanStack AI is a type-safe, provider-agnostic SDK that ends vendor lock-in. Switch between OpenAI, Claude, and Gemini without rewriting code. Full guide with examples.

Shadcn/ui Is Now a Full Project Generator – Not Just Components!
shadcn/ui now generates complete Design Systems with 5 visual styles, Base UI support, and custom components. Learn how npx shadcn create transforms your workflow.