Marketo Hack: Automatically add utm parameters to (all) Marketo emails

ga_utm_marketo

Having even a few users simultaneously creating emails in Marketo risks a misalignment and if you have a tagging strategy for Google Analytics everybody might not follow it.

Some may ask: “Why do we even need to use utm tags if we have Marketo?” – Well, for one everything should be tagged up both incoming traffic to Marketo and traffic generated by Marketo. The ideal situation is to be able to easily see what traffic is driving conversions/goals. What works vs What doesn’t.

The ideal situation is for these tags to always work without requiring users to need to think or spend too much time trying to figure out how to tag their link. With the new 2.0 email editor with variables all you need to do is add Local Variables to each module for both the link and the utm tag (this should be done in the template).

 

Alternative 1 – Whole UTM string in one variable

Variables defined:

<meta class=”mktoString” id=”link-variable” mktoName=”URL” default=”#” mktoModuleScope=”true”>
<meta class=”mktoString” id=”utm-tag” mktoName=”UTM” default=”?utm_source=mkto&utm_medium=email&utm_campaign={{program.Name}}” mktoModuleScope=”true”>

 

To describe the values a bit better:

mktoModuleScope (case sensitive): a boolean variable (true/false) meaning it needs to be included and marked true if you want it to be unique on a modular level, otherwise it will use the same value across the template.

{{program.Name}}: The new program token (more info here) for name can also show the program name from where the traffic came from, works great if you have a good naming convention. This should also fix itself if you are using spaces in your program names to not break the link and to show the same value in GA.

default value: The value that will always be present

mktoName (case sensitive): The friendly name to be displayed to whomever is editing your post

 

Whenever you want to add a variable to an email (or landing page) template, you refer to it’s previously defined id from the head: ${id}

After these are defined, all you need to do is add the corresponding variables defined inside the links in the code for your modules.

Looking something like this:

<a href=”${link-variable}${utm-tag}”>

 

Alternative 2 – Split up each UTM tag into multiple variables

If you are regularly adding e.g. utm_content tags for differentiating different variants this may be friendlier for you.

This can also be done by defining five variables, one for each utm_parameter value and just have the default value blank (if you don’t usually use it) or fill in the default like the example above (utm_medium=email etc..)

<a href=”${link-variable}?utm_source=${utm-source}&utm_medium=${utm-medium}&utm_campaign=${utm-campaign}&utm_term=${utm-term}&utm_content=${utm-content}”>

 

If a link contains a blank utm_parameter with & following it, GA should skip it and move to the next one without causing a broken link.

 

When this is done you are ready to get going with your email sendouts so they automatically track your defined UTM tags. Send me an email at erik.heldebro@avaus.se if you have any questions or need some help implementing this.