Can't link to anchors from emails

Highlighted
Anonymous
Not applicable

Can't link to anchors from emails

Apologies if this has been covered somewhere and I can't find it.  I am trying to add a link in a Marketo email that looks like this:  http://www.foo.com/page.html#someSection

My obvious intention is that the link will go to page.html and skip down to the paragraph id called #someSection.

But when I add this from the marketo email, marketo appends a long query string to the end of the url like this:

http://www.foo.com/page.html#someSection?mkt_tok=eyJpIjoiT0RRMFlURmlPRGd4WTJZeSIsInQiOiJpQ0lhNUp5ell...

This breaks the anchor tag and the scrolling I'm looking for doesn't happen.  The reason is that anchor tags should go after query strings, like this:

http://www.foo.com/page.html?mkt_tok=eyJpIjoiT0RRMFlURmlPRGd4WTJZeSIsInQiOiJpQ0lhNUp5ellZeFlZZE5Rd0N...

I'm certain there must be some workaround for this.  Help is appreciated.

Many thanks!

10 REPLIES 10
Highlighted

Re: Can't link to anchors from emails

Easy one:

Uncheck the bottom two boxes.

pastedImage_0.png

But in my experience not all email clients will respect the anchor links.

Highlighted

Re: Can't link to anchors from emails

Just uncheck "include mkt_tok" no need to make it untracked

Highlighted
Anonymous
Not applicable

Re: Can't link to anchors from emails

Thanks so much! Just to be sure, if I don't include the marketo token, will marketo still track the click-thrus?

Thank you!

Highlighted

Re: Can't link to anchors from emails

yes

Highlighted
Level 10 - Community Moderator

Re: Can't link to anchors from emails

Amy, weigh this decision carefully.  When you turn off automatic mkt_tok-enization but leave tracking on, you will get the Clicked Email events tied to the email, but you will not get subsequent web activities (Visit Web Page and Clicked Link in Web Page) because leads will be anonymous on your website.  This is a major tradeoff.   It's akin to having all your email links be direct links to PDFs, which similarly can't associate web sessions -- a practice to be avoided.

IMO, given this choice, I would rather get the web activities, since you can reverse-engineer the Clicked Emails from the Visits. (Email performance reports will be affected, yes, but the click target itself can be detected from the web side.)  You can get the web activities by turning off tracking in the editor, but then manually adding ##MKT_TOK## to the link: http://example.com/mypage?mkt_tok=##MKT_TOK###hashtag.

But you really aren't faced with this choice. If you want to scroll to a specific ID on the page, simply pass the ID in the query string, not in the hash (&openTo=someSection). Then use this very easy JS:

<script>

  document.getElementById(getURLParameter('openTo')).scrollIntoView();

/**

* @see [IOWA Util]

*/

function getURLParameter(param) {

    if (!window.location.search) {

        return;

    }

    var m = new RegExp(param + '=([^&]*)').exec(window.location.search.substring(1));

    if (!m) {

        return;

    }

    return decodeURIComponent(m[1]);

}

</script>

Highlighted

Re: Can't link to anchors from emails

To confirm; if you add the ?mkt_tok= query parameter, Marketo will still add in the same query parameter somewhere else in the URL?

i.e.

www.google.com/?q=myquestion#answer1?mkt_tok=123

turns into

www.google.com/?q=myquestion?mkt_tok=123#answer1?mkt_tok=123

Highlighted
Level 10 - Community Moderator

Re: Can't link to anchors from emails

Yes, it will be redundantly added if you don't turn off mkt_tok formally.

I would use my other method anyway.  Too much confusion if some emails track clicks and others don't.

Highlighted
Anonymous
Not applicable

Re: Can't link to anchors from emails

Hi Nicholas

You mentioned that in your experience not all email clients will respond to anchor links. Do you know if this is the case for Outlook? I have followed the steps but cannot seem to get the anchors to work.

When I view the html version of my email the links work fine, but not when I view the email in both Outlook and Gmail.

Any comment would be much appreciated!

Highlighted
Anonymous
Not applicable

Re: Can't link to anchors from emails

I've just seen another article talking about exactly this which provides some answers: https://nation.marketo.com/message/122193#comment-122193