How to combine UTM token with anchor link?

Anonymous
Not applicable

How to combine UTM token with anchor link?

Hello,

Is it possible to combine a UTM tracking token (eg utm_source=marketo) with an anchor link (eg #pic2)? It doesn't seem to work from what I've tested so far as the anchor link needs to be the very last section in the URL, but the UTM tracking token needs to be last section as well.

For example if my URL is: www.website.com/stories#pic2/{{my.UTM-Encoding}}&utm_content=campaign1

It won't scroll to the #pic2 anchor link, but the UTM tracking is fine.

I can't make the URL like this either because it'll treat it as an invalid URL: www.website.com/stories/{{my.UTM-Encoding}}&utm_content=campaign1#pic2

Does anyone know how the syntax should work?

Thanks.

7 REPLIES 7
Jim_Thao7
Level 9

Re: How to combine UTM token with anchor link?

The first thought that came to my mind is that you need a "?" to start your very first parameter off right.

Therefore, it should look something like this: www.website.com/stories/?{{my.UTM-Encoding}}&utm_content=campaign1#pic2

Anonymous
Not applicable

Re: How to combine UTM token with anchor link?

Thanks Jim.

That was actually a typo in my post, forgot to put the "?". But in my email the "?" is there. Problem still stands.

Jim_Thao7
Level 9

Re: How to combine UTM token with anchor link?

Syntax is correct then.  Syntax is not the issue.  Could be that the issue is probably how your domain resolves URLs.  Does it allow parameters?

Instead of clicking through to it from your email, try it organically with dummy values to see what happens. 

There are also other unknowns here, like, what is an example value for your token {{my.UTM-Encoding}}?  Is it complete, like "utm_medium=something" or is it just "something".

Please make sure that you check all of the features your'e using vs. just the syntax.

Anonymous
Not applicable

Re: How to combine UTM token with anchor link?

Hi Jim

This is the full URL format including the token: http://mywebsite.com/stories#pic2/?mc=1234567&utm_source=marketo&utm_medium=email&utm_campaign=newsl...

The blue section is the token.

I'll ask our dev on if it's an issue on the website not accepting parameters.

Thanks

Jim_Thao7
Level 9

Re: How to combine UTM token with anchor link?

This still looks incorrect because you're putting the anchor before the parameters.

Your base URL actually also looks very awkward and I'm not sure if that's entirely correct: http://mywebsite.com/stories#pic2/ 

Is that another typo? What is your base URL?

Your full resolved URL should look like this: http://domain.com/folder/?utmparameters=utmparameters#anchor

Anonymous
Not applicable

Re: How to combine UTM token with anchor link?

Hi Jim

After some more digging I found that the extra "/" after ".../stories" is the problem, removing this solved the issue. And yes adding the anchor link to the very end seems to be the way to do it:

Original: http://site.mywebsite.ca/stories/{{my.UTM-Encoding}}&utm_content=campaign1#pic2

Fixed: http://site.mywebsite.ca/stories{{my.UTM-Encoding}}&utm_content=campaign1#pic2

Thanks.

SanfordWhiteman
Level 10 - Community Moderator

Re: How to combine UTM token with anchor link?

Note these are both equally valid, correctly constructed URLs:

     http:​//site.example.ca/pathname/?queryparam1=value1&queryparam2=value2#hash

     http:​//site.example.ca/pathname?queryparam1=value1&queryparam2=value2#hash

However, regardless of whether they are valid, they may point to different resources (i.e. pages or downloads) on your server, one (or both) of which may not exist.

A strict webserver will throw a 404 error if the resource doesn't exist at that exact URL.

Some webserver configurations consider the versions with and without the trailing slash in the path to be equivalent.

Some webservers internally consider the two versions to be different, but will (confusingly) do a "courtesy redirect" if they think you've made a typo (that is, if they see that the one you requested would be a 404, but the "other one" exists, they'll redirect your browser to the other one).

The hash always, without any exceptions, is the last component of a URL.