🔗URL & UTM
UTM Campaign Naming Convention
Standardized naming conventions for UTM campaign parameters
Explanation
Consistent UTM naming prevents tracking chaos and enables better analytics reporting.
Examples
Campaign structure
Input
campaign_name
Output
{channel}_{type}_{descriptor}_{date}Example
Input
email_promo_summer_sale_2024_q2
Output
Clear channel, type, descriptor, and timing
Code Examples
JavaScript
// UTM Parameter naming convention
const UTM_STRUCTURE = {
source: {
description: 'Where traffic originates',
examples: ['google', 'facebook', 'newsletter', 'twitter'],
rules: ['lowercase', 'no-spaces', 'descriptive']
},
medium: {
description: 'Marketing medium',
examples: ['cpc', 'email', 'social', 'referral', 'display'],
rules: ['lowercase', 'standard-terms']
},
campaign: {
description: 'Campaign identifier',
format: '{channel}_{type}_{descriptor}_{date}',
examples: [
'email_promo_summer_sale_2024_q2',
'social_organic_product_launch_jan',
'paid_search_brand_keywords_2024'
]
},
content: {
description: 'Ad/content variant',
examples: ['hero_banner', 'sidebar_cta', 'text_link_1'],
usage: 'A/B testing, multiple links in same content'
},
term: {
description: 'Paid search keywords',
examples: ['blue_widgets', 'best_saas_tool'],
usage: 'Primarily for paid search campaigns'
}
};
// Campaign name builder
function buildCampaignName(parts) {
const { channel, type, descriptor, date } = parts;
// Validate all parts present
if (!channel || !type || !descriptor) {
throw new Error('Missing required campaign parts');
}
// Build name
const nameParts = [
channel.toLowerCase(),
type.toLowerCase(),
descriptor.toLowerCase().replace(/\s+/g, '_'),
];
if (date) {
nameParts.push(date.toLowerCase());
}
return nameParts.join('_');
}
// Usage
const campaignName = buildCampaignName({
channel: 'email',
type: 'promo',
descriptor: 'summer sale',
date: '2024_q2'
});
// Result: 'email_promo_summer_sale_2024_q2'
// Full UTM URL builder
function buildUTMUrl(baseUrl, params) {
const url = new URL(baseUrl);
// Required parameters
url.searchParams.set('utm_source', params.source.toLowerCase());
url.searchParams.set('utm_medium', params.medium.toLowerCase());
url.searchParams.set('utm_campaign', params.campaign.toLowerCase());
// Optional parameters
if (params.content) {
url.searchParams.set('utm_content', params.content.toLowerCase());
}
if (params.term) {
url.searchParams.set('utm_term', params.term.toLowerCase());
}
return url.toString();
}
// Example
const url = buildUTMUrl('https://example.com/product', {
source: 'newsletter',
medium: 'email',
campaign: 'email_promo_summer_sale_2024_q2',
content: 'hero_cta'
});Try it Now
💡 Tips
- Document your naming convention
- Use lowercase only
- Use underscores, not spaces or hyphens
- Be consistent with date formats (YYYY_MM or 2024_q1)
- Include enough context but keep it readable
- Create a template or generator tool
- Train team on conventions
- Review campaigns quarterly for consistency
⚠️ Common Pitfalls
- Inconsistent naming kills reporting
- Too long campaign names are unreadable
- Abbreviations without documentation
- Mixing camelCase, snake_case, kebab-case
- Forgetting to lowercase parameters
- Not including date/version tracking