Marketo UTMs' "amp;" issue | Community
Skip to main content
Roy_Grossman
New Participant
July 16, 2019
Solved

Marketo UTMs' "amp;" issue

  • July 16, 2019
  • 3 replies
  • 9647 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

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

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

3 replies

SanfordWhiteman
New Participant
July 19, 2019

Again @Roy Grossman‌ please return to the Community and mark my answer as correct.

Roy_Grossman
New Participant
July 21, 2019

Hi Sanford,

Thank you for your reply and sorry for the delay in reading and marking it.

Anyway - it's done.

Much appreciated,

Roy

SanfordWhiteman
New Participant
July 17, 2019

OP please return to your thread and check responses.

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
July 16, 2019

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

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>‍‍‍
New Participant
January 27, 2022

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
New Participant
January 27, 2022
Are they clicking the Text part of a multipart email, or a Text-only email? Because you can't HTML-encode in that context.