How to automatically add utm parameters to Marketo emails

Having even a few users simultaneously creating emails in Marketo risks misalignment. 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.

You would want to be able to easily see what traffic is driving conversions/goals. What works vs What doesn’t.

The ideal tagging situation is for users to avoid needing to tag links. With Marketo, Local Variables can be added to each module for the link and the utm tag. This will be done in the email template using default values.

Alternative 1 – Whole UTM string in one variable

Variables defined:

To describe the values a bit better:

mktoModuleScope (case sensitive): A boolean attribute (true/false). Include this with the value = true. This will make a variable unique within the module it is used. This allows to re-use the variable in different modules.

{{program.Name}} (more info here): Program token that displays the name of the Marketo program that drove the traffic. This works great if you have a good naming convention. The link will not break if your program name includes spaces.

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:

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..)

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 started. Your emails will automatically track your defined UTM tags.