Re: Automatically add utm parameters to links

Anonymous
Not applicable

Other marketing automation tools I've used have allowed you to globally set a url tracking template that will be added to all links.  Is there a way to do this?  When we create emails with links in them, I want marketo to automatically add utm parameters to pass data to google analytics, like http:///www.example.com/?utm_medium=email&utm_source=email-name&utm_content=text-of-link

Having to manually add these parameters for every link is a huge time drain.

17 REPLIES 17
Erik_Heldebro2
Level 8

Hi,

When creating Email Templates in the new 2.0 with variables I added Local Variables to each module for both the link and the utm tag.

Here's an example:

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">

Edit: The new program token for name can also show the program name from where the traffic came from, works good if you have a good naming convention.

Then where I add the links into modules I put it in like this:

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

When editing each module it also allows me to for example add a &utm_content= if relevant or remove the whole utm string if it is irrelevant or linking to somewhere that would not support the querystring (exact link).

This can also be done by adding five variables, one for each utm_parameter and just have the default value blank like this:

<a href="${link-variable}?utm_source=${utm-source}&utm_medium=${utm-medium}...

To my knowledge if a link contains a blank utm_parameter with & following it should skip it in GA and add the next one.

/Erik

Anonymous
Not applicable

Erik,

Do the variable have to be in a "module". I have been trying to do the same thing by just defining the meta class and then using the ${"id"} in the template HTML (<a href="${cta-url}${cta-utm-tag}" ...) but, while the variable for the CTA button works fine in the editor, I am unable to see or edit the actual URL.

Thanks,

Eddie

SanfordWhiteman
Level 10 - Community Moderator

You can use standalone variables, if that's what you're asking. But don't include the protocol ("http​://" or "http​://") in the variable -- keep that hard-coded.

Anonymous
Not applicable

Sanford - I fixed it. Rookie mistake.

<a href="https://${cta-url}${cta-utm-tag}" ...>

Works fine. I was just puzzled as to why I could not get the variables to appear in the editor when I formatted the href like that the first time.

Mysteries.

Thanks again.

Eddie

Anonymous
Not applicable

Thanks for the reply Sanford.

So, I was able to get the form field to appear in the editor under Global Variables by formatting like this:

<a href="https://"${cta-url}${cta-utm-tag} ...>

However, when I add values and then preview the code the href value comes across as:

<a href="https://" ${cta-url}${cta-utm-tag}="" ...>

Sending a test results in a broken link.

I am going to keep toying with it but if you can enlighten me, I would appreciate it. Thanks!

Eddie

SanfordWhiteman
Level 10 - Community Moderator

The whole URL must be enclosed in quotes, not the protocol only.

SanfordWhiteman
Level 10 - Community Moderator

To my knowledge if a link contains a blank utm_parameter with & following it should skip it in GA and add the next one.

Yep, a query key with no value (&key& or &key=&) is considered a param with an empty value (rather than an error).

Grégoire_Miche2
Level 10

Hi Sanford Whiteman,

what happens if a utm parameter value contains white spaces? For instance, the {{program.name}} user may contain white spaces such as "My New Gated Content Program"

-Greg

SanfordWhiteman
Level 10 - Community Moderator

The web browser -- the app that makes the HTTP connection -- should URL-encode those spaces to %20 automatically (we usually try to do this before the link is placed in the page, but in reality modern browsers will take care of it for you).

Anonymous
Not applicable

I'm not sure if this is helpful or not... we too create unique UTM parameters for each email and store those in an excel file (so no good answer there).  However, we put a token {{my.tracking}} in our templates at the end of every link... so that way we only need to copy and paste the UTM parameter in the email token once... and then it automatically adds it to every link in the email.

In the new 2.0 emails - you could probably also just make a global variable that is appended to every link in the email too.

Again - these don't help if you're wanting the whole UTM parameter to be created automatically... but they do help so that you only have to add the UTM parameter once to the email (instead of having to add it to every link within the email).

<a href="http:///www.example.com/{{my.tracking}}" target="_blank">Random Link Example</a>

Grégoire_Miche2
Level 10

Hi Ryan,

The global variable is indeed the way to go. You can probably combine with {{my. and the new {{program tokens and local variables so that all of you CTA's are "UTM Appended".

I'll run a test on this and share it.

-Greg

Anonymous
Not applicable

Hi Grégoire,

Did you run a test? Curious to get to know the result.

...

SanfordWhiteman
Level 10 - Community Moderator

There's also this bookmarklet I created to check for UTM params on all links. It won't add the params for you, but it'll run a pre-flight check to where they're missing.

I agree that tokens are essential minimizing the potential damage done by this missing feature.

Ravi_Ansal2
Level 6

Yes same as Josh, we created one spreadsheet with the drop down UTM values.

Josh_Hill13
Level 10 - Champion Alumni

use a spreadsheet with CONCATENATE. There's one on my site.

Grégoire_Miche2
Level 10

Hi Justin,

Not possible. Referenced here: Just do it! Marketo so-called minor missing features​ 

-Greg

Mark_Knight
Level 3

This is so FRUSTRATING - this is basics, level 1 requirements, yet the functionality is missing (and as you point out in so many other areas too) when this is included in more basic (and cheaper) solution offerings.

 

Have any of your suggestions been taken up, or are Marketo (Adobe) just advancing to broaden functionality to make their solution have the new areas only a few will want whilst ignoring core areas that any marketeer would take for granted as being present in 2020 - checking whether a marketing automation system can automatically / easily integrate into GA in 2020 should be a given.... not something you have to retro fit yourself.