SOLVED

Re: Marketo UTMs' "amp;" issue

Go to solution
Roy_Grossman
Level 1

Marketo UTMs' "amp;" issue

Hi,

I'm working on few emails and came across a weird issue-

When copy-pasting a UTM into marketo, it adds "amp;" to the UTM.

For example, the following UTM:

www.google.co.il?&utm_source=marketo&utm_medium=email&utm_campaign=test

Will be converted into this one:

www.google.co.il?&utm_source=marketo&utm_medium=email&utm_campaign=test

I tried using the "HTML source editor" and the "insert/edit link" button, both didn't work.

Can you please tell how/if it affects the UTM?

Thanks,

Roy

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo UTMs' "amp;" issue

It's not an "issue" — there would be an issue if links weren't built this way!

In HTML, the ampersand (&) character has special meaning: it's the character at the beginning of a character reference. You've seen such references as © or ‍ in the past, I'm sure.

In order to avoid breaking links, whenever you want a a literal & — that is, where you aren't using it to start off a special character reference — you must use its own character reference, which is &. This means that what you think of as a run-of-the-mill URL like

https://www.example.com/?utm_medium=email&utm_campaign=myCompaign‍‍‍

when it appears in the href of an <a> tag, should be written:

<a href="https://www.example.com/?utm_medium=email&amp;utm_campaign=myCompaign">Click here</a>‍‍‍

Note that the URL as sent by the browser doesn't have the &amp; in it. The &amp; is necessary only within HTML, to make sure the link is rendered unambiguously. Again, you'd never type &amp; in the browser bar, it has no special meaning there and you'd mess things up in the other direction!

You're probably thinking. "But I don't think my links have ever been broken...."  True, you might've gotten lucky so far. But to give you an idea of how a link can be broken without &amp; imagine you're trying to get people to the URL:

https://www.example.com/?audience=global&euro;germany;berlin ‍‍‍‍‍

If you put that in an href as-is:

<a href="https://www.example.com/?audience=global&euro;germany;berlin">test render</a>‍‍‍

The link will be broken, because you've accidentally included a character reference: &euro; is the character ref for the Euro symbol! So people will end up on the wrong page (probably a 404):

pastedImage_2.png

The correct way to link to that URL in HTML is indeed:

<a href="https://www.example.com/?audience=global&amp;euro;germany;berlin">test render</a>‍‍‍

View solution in original post

11 REPLIES 11
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo UTMs' "amp;" issue

It's not an "issue" — there would be an issue if links weren't built this way!

In HTML, the ampersand (&) character has special meaning: it's the character at the beginning of a character reference. You've seen such references as &copy; or &#8205; in the past, I'm sure.

In order to avoid breaking links, whenever you want a a literal & — that is, where you aren't using it to start off a special character reference — you must use its own character reference, which is &amp;. This means that what you think of as a run-of-the-mill URL like

https://www.example.com/?utm_medium=email&utm_campaign=myCompaign‍‍‍

when it appears in the href of an <a> tag, should be written:

<a href="https://www.example.com/?utm_medium=email&amp;utm_campaign=myCompaign">Click here</a>‍‍‍

Note that the URL as sent by the browser doesn't have the &amp; in it. The &amp; is necessary only within HTML, to make sure the link is rendered unambiguously. Again, you'd never type &amp; in the browser bar, it has no special meaning there and you'd mess things up in the other direction!

You're probably thinking. "But I don't think my links have ever been broken...."  True, you might've gotten lucky so far. But to give you an idea of how a link can be broken without &amp; imagine you're trying to get people to the URL:

https://www.example.com/?audience=global&euro;germany;berlin ‍‍‍‍‍

If you put that in an href as-is:

<a href="https://www.example.com/?audience=global&euro;germany;berlin">test render</a>‍‍‍

The link will be broken, because you've accidentally included a character reference: &euro; is the character ref for the Euro symbol! So people will end up on the wrong page (probably a 404):

pastedImage_2.png

The correct way to link to that URL in HTML is indeed:

<a href="https://www.example.com/?audience=global&amp;euro;germany;berlin">test render</a>‍‍‍
Chris_Conley_86
Level 2

Re: Marketo UTMs' "amp;" issue

Hey Sanford,

 

I know this is an old post - but we, or I, am having an issue where the &amp; is being left in the email and breaking the link. Any idea why this is? I am at a loss.

 

Thanks!

 

Chris

 

PS It works for me and my colleagues but partners are replying to the email pointing out the link doesn't work and it's because it's trying to access the page with &amp; instead of '&'

 

Thanks again!

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo UTMs' "amp;" issue

Are they clicking the Text part of a multipart email, or a Text-only email? Because you can't HTML-encode in that context.
Chris_Conley_86
Level 2

Re: Marketo UTMs' "amp;" issue

No - it's the HTML version. The partners forward me the email and I send them the data they should've seen, and every single time it's because the link in the button is sending them to a URL with '&amp;' instead of '&' - it works fine when I test it - so I dunno if maybe some email clients don't convert the HTML versions of special characters in the href section of the a tag or what the deal is.

 

I haven't been this stumped in a very long time.

 

Thanks for getting back to me too!

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo UTMs' "amp;" issue

How are you making sure it's the HTML version (that is to say, how do you know for sure which part they've viewed + clicked)?

 

In any case please send me one of these emails. I've PM'd you my address.

Chris_Conley_86
Level 2

Re: Marketo UTMs' "amp;" issue

I've sent you both a forwarded email from a partner and a test email - thanks for taking a look at this!

 

The test emails and the emails the partners are replying to, always work for me. But their forwarded emails don't.

 

Thanks!

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo UTMs' "amp;" issue

@Chris_Conley_86 did you see my response?

Chris_Conley_86
Level 2

Re: Marketo UTMs' "amp;" issue

I did - sorry I was working on this while on vacation last week

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo UTMs' "amp;" issue

OP please return to your thread and check responses.