How is everyone doing utm tracking efficiently in email?
There has to be an easy way to set utm tracking at the program level right? I'm seeing posts from 2017-2019 that this wasn't an option but I'm hoping that's changed?
Solved! Go to Solution.
You can use Program Member Custom Fields to track your UTMs at the program level. Do beware that you have a limited number PMCFs that you can have in your instance, but, if this is something you're going to use frequently, they can be quite useful.
You can use Program Member Custom Fields to track your UTMs at the program level. Do beware that you have a limited number PMCFs that you can have in your instance, but, if this is something you're going to use frequently, they can be quite useful.
Not sure what you mean by “email only” but if you mean the UTM params that are in the URL when a form is filled out, then yes: the combo of Hidden field AutoFill and Program Member Custom Fields can be used to store those values at the program member level.
If you’re talking about the wider world of UTM persistence, i.e. beyond the current page, you still need a separate JS library. There are many — I’ve actually written three different ones!
Hey Sanford,
I've created UTMs on the program member, I'm using flow steps to stamp those values to the campaign member. My issue is the SFDC campaign member is being created, but no UTM values are being stored. What am I missing here?
What is the purpose of that Wait step?
Do you have SFDC Campaign Member Field sync set up in Admin? It doesn’t look like it, because if you did you wouldn’t need the Change Status in SFDC Campaign step at all.
So, I do.
The problem is I'm inheriting an instance with wonky channel tags that don't match the SFDC member statuses so I can't use the SFDC native program sync.
Also, this is the code we've used on the website:
<script>
// Set cookie function
function setCookie(name, value, expiration) {
var d = new Date();
d.setTime(d.getTime() + (expiration * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = name + "=" + value + ";" + expires + ";path=/";
}
// Function to get value of parameter from URL
function getParamValue(paramName) {
var queryString = window.location.search;
var urlParams = new URLSearchParams(queryString);
return urlParams.get(paramName);
}
// Check if any UTM parameters are present in URL
var utmMedium = getParamValue('utm_medium');
var utmSource = getParamValue('utm_source');
var utmCampaign = getParamValue('utm_campaign');
var utmContent = getParamValue('utm_content');
var utmTerm = getParamValue('utm_term');
var gclid = getParamValue('gclid');
var marketingCta = getParamValue('Marketing_CTA');
var campaignMemberStatus = getParamValue('Campaign_Member_Status');
var campaignId = getParamValue('CampaignID');
// If utm_source is not present, set it based on referrer
if (!utmSource) {
var referringUrl = document.referrer;
if (referringUrl.includes('google.com') || referringUrl.includes('bing.com') || referringUrl.includes('yahoo.com')) {
utmMedium = 'Organic';
utmSource = referringUrl.includes('google.com') ? 'Google' : referringUrl.includes('bing.com') ? 'Bing' : 'Yahoo';
if (!utmCampaign) {
utmCampaign = 'Not-Provided';
}
if (!utmContent) {
utmContent = 'Not-Provided';
}
} else if (referringUrl.includes('facebook.com') || referringUrl.includes('twitter.com') || referringUrl.includes('t.co') || referringUrl.includes('linkedin.com')) {
utmMedium = 'Social';
utmSource = referringUrl.includes('facebook.com') ? 'Facebook' : referringUrl.includes('twitter.com') || referringUrl.includes('t.co') ? 'Twitter' : 'LinkedIn';
if (!utmCampaign) {
utmCampaign = 'Not-Provided';
}
if (!utmContent) {
utmContent = 'Not-Provided';
}
} else if (referringUrl) {
utmMedium = 'Referral';
utmSource = referringUrl;
if (!utmCampaign) {
utmCampaign = 'Not-Provided';
}
if (!utmContent) {
utmContent = 'Not-Provided';
}
} else {
utmMedium = 'Direct';
utmSource = 'Outreach.io';
if (!utmCampaign) {
utmCampaign = 'Not-Provided';
}
if (!utmContent) {
utmContent = 'Not-Provided';
}
}
}
// If no UTM parameters are present and no referrer, set utm_source to Direct and utm_medium to Direct
if (!utmMedium && !utmSource) {
utmMedium = 'Direct';
utmSource = 'Outreach.io';
if (!utmCampaign) {
utmCampaign = 'Not-Provided';
}
if (!utmContent) {
utmContent = 'Not-Provided';
}
}
if (!utmTerm) {
utmTerm = 'Not-Provided';
}
if (!gclid) {
gclid = 'Not-Provided';
}
if (!marketingCta) {
marketingCta = 'Not-Provided';
}
if (!campaignMemberStatus) {
campaignMemberStatus = 'Not-Provided';
}
if (!campaignId) {
campaignId = 'Not-Provided';
}
// Set cookies for UTM parameters
if (utmMedium) {
setCookie('UTM_MEDIUM', utmMedium, 30);
}
if (utmSource) {
setCookie('UTM_SOURCE', utmSource, 30);
}
if (utmCampaign) {
setCookie('UTM_CAMPAIGN', utmCampaign, 30);
}
if (utmContent) {
setCookie('UTM_CONTENT', utmContent, 30);
}
if (utmTerm) {
setCookie('UTM_TERM', utmTerm, 30);
}
if (gclid) {
setCookie('GCLID', gclid, 30);
}
if (marketingCta) {
setCookie('MARKETING_CTA', marketingCta, 30);
}
if (campaignMemberStatus) {
setCookie('CAMPAIGN_MEMBER_STATUS', campaignMemberStatus, 30);
}
if (campaignId) {
setCookie('CAMPAIGNID', campaignId, 30);
}
</script>
Please remember to use the Syntax Highlighter when providing code so it’s readable. I edited your post this time.
You can’t update SFDC Campaign Member Fields unless you have the SFDC Campaign ↔︎ Marketo Program sync turned on for a program. Simple as that.
What’s the Wait step for?
Got it! That totally makes sense.
I didn't remember that previously when I set this up I had another system stamping the UTM values after Marketo creates the CM.
Thanks Sanford!