SOLVED

Re: UTM tracking at the program level (email only)

Go to solution
Karen_Vuong
Level 2

UTM tracking at the program level (email only)

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? 

Karen Vuong
1 ACCEPTED SOLUTION

Accepted Solutions
Christiane_Rode
Level 7 - Community Advisor + Adobe Champion

Re: UTM tracking at the program level (email only)

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.

 

 

View solution in original post

7 REPLIES 7
Christiane_Rode
Level 7 - Community Advisor + Adobe Champion

Re: UTM tracking at the program level (email only)

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.

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: UTM tracking at the program level (email only)

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!

kkeefer1313
Level 2

Re: UTM tracking at the program level (email only)

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? 

 

Screenshot 2023-08-28 at 2.03.30 PM.pngScreenshot 2023-08-28 at 3.43.58 PM.pngScreenshot 2023-08-28 at 3.44.07 PM.png

SanfordWhiteman
Level 10 - Community Moderator

Re: UTM tracking at the program level (email only)

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.

kkeefer1313
Level 2

Re: UTM tracking at the program level (email only)

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.

 

Screenshot 2023-08-28 at 4.29.23 PM.png

 

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>



SanfordWhiteman
Level 10 - Community Moderator

Re: UTM tracking at the program level (email only)

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?

kkeefer1313
Level 2

Re: UTM tracking at the program level (email only)

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!