SOLVED

UTM string being re-arranged on webpage

Go to solution
NadineRegan
Level 2

UTM string being re-arranged on webpage

What would cause the UTM string to be re-arranged when hitting a webpage?


In MKTO our utm string looks like this when added to emails: 
?utm_source=mkto&utm_medium=Email&utm_campaign=XXX

 

But when clicking through the link (in some cases) it shows up like this on the webpage: 
?utm_medium=Email&utm_campaign=XXX&utm_source=mkto

Anyone have any idea what might be causing this? I am just curious. We've recently changed web platforms and since then have encountered that issue with some pages but not all of them.

PS. I realize this is not really a MKTO question but it is somewhat related so I hope someone will still answer 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: UTM string being re-arranged on webpage

Please link to your page so we can look further.

 

Query parameters are ordered. That is, apples=yes&oranges=no is different from oranges=no&apples=yes. However, the order rarely matters in practice, as code just seeks the value of apples regardless if it came first or second. (Yes, there are major exceptions, but they’re outside the realm of UTM parameters.)

 

I suspect you have code that parses the query string, inspects each UTM param in a hard-coded internal order, and rewrites it. Confusing but not unprecedented.

View solution in original post

6 REPLIES 6
jsiebert
Level 5

Re: UTM string being re-arranged on webpage

@NadineRegan I'd check to see if there is some sort of redirect rule on your new platform. There may be a RegEx script that is reordering your UTM strings. (Disclaimer: I am no expert on this, just did a quick search and found this Reddit thread)

Jack Siebert
NadineRegan
Level 2

Re: UTM string being re-arranged on webpage

It was indeed a redirect issue, almost not noticeable (one letter changed in the new URL path).

joshhughes
Level 1

Re: UTM string being re-arranged on webpage

@NadineRegan Is it consistent for certain users or links?  Or is it random and inconsistent?  

SanfordWhiteman
Level 10 - Community Moderator

Re: UTM string being re-arranged on webpage

Please link to your page so we can look further.

 

Query parameters are ordered. That is, apples=yes&oranges=no is different from oranges=no&apples=yes. However, the order rarely matters in practice, as code just seeks the value of apples regardless if it came first or second. (Yes, there are major exceptions, but they’re outside the realm of UTM parameters.)

 

I suspect you have code that parses the query string, inspects each UTM param in a hard-coded internal order, and rewrites it. Confusing but not unprecedented.

NadineRegan
Level 2

Re: UTM string being re-arranged on webpage

Hi Sanford,

 

just as I was ready to provide you with a link to our page I realized that the URL path slighly changed (e.g. guide vs. guides) which seemed to have caused the problem as part of some re-direct we had in place.

Tip for anyone who might see this in the future: Make sure your web team is aware that even the slightest changes to URLs can cause major headaches for someone else. 🤣

SanfordWhiteman
Level 10 - Community Moderator

Re: UTM string being re-arranged on webpage

Yep, it’s usually something like that. Either query parameters are re-added in a hard-coded order (as I noted above) or they’re re-added in alphabetical order.