Campaigm UTM URL paramaters being removed from product pages

Zyber_Limited
Shopify Expert
2 0 0

ttps://www.example.com/products/product1?utm_source=facebook&utm_medium=paid_social&utm_campaign=modelvideo&utm_content=modelvideo&fbclid=xxxxxxxxxxxxxxxx

but automatically redirects to the variant URL > https://www.example.com/products/product1?variant=123456789

 

any solution to avoid this redirection? we want to track each campaign's activities and conversion.

Replies 20 (20)

Niki_K
Shopify Partner
447 45 124

Hi @Zyber_Limited,

Based on the example you sent:

https://www.example.com/products/product1?variant=123456789

This example page has already the question mark …./product1?variant…/

So using one more question mark won’t be working.

So I suggest using ampersand (&) instead, you might also need to include equal sign before the ampersand.

I recommend using this tool: https://ga-dev-tools.web.app/campaign-url-builder/

It will generate the url with the UTM parameter for you — you will see if you need to use the ampersand and the equal sign. Try this out.

Maybe this could help.

Send me a link to your store to niki@ecommercepot.com and I'll help you out.
For more info what I do, visit my agency website ecommercepot.com or my personal website nikikozak.me.

Josh_Uebergang
Shopify Expert
1012 43 268

Just use this URL and it'll be fine:

https://www.example.com/products/product1?variant=123456789&utm_source=facebook&utm_medium=paid_soci...

Notice the & after the variant ID in the URL (bolded to show you).

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
Niki_K
Shopify Partner
447 45 124

Hi @Josh_Uebergang,

Happy to hear that's working. So, no equal sign was needed, just an ampersand. Great!

Send me a link to your store to niki@ecommercepot.com and I'll help you out.
For more info what I do, visit my agency website ecommercepot.com or my personal website nikikozak.me.
KutokuTim
Tourist
5 0 4

I'm struggling with this issue too and the suggested solutions do not work. Take this URL:

https://shop.heddels.com/collections/battenwear/products/bouldering-pants-caramel-fw20?variant=39575...

If I add a utm_medium=email like so:

https://shop.heddels.com/collections/battenwear/products/bouldering-pants-caramel-fw20?variant=39575...

The utm_medium parameter is stripped (I believe by JS) and I end up at the original URL:

https://shop.heddels.com/collections/battenwear/products/bouldering-pants-caramel-fw20?variant=39575...

This happens with _any_ added query param other than variant.

Does anyone know how I can resolve this?

Niki_K
Shopify Partner
447 45 124

Hi @KutokuTim,

it's weird that it isn't working. It can be also because of some redirects: 

https://shop.heddels.com/collections/battenwear/products/bouldering-pants-caramel-fw20?variant=39575...

https://shop.heddels.com/products/bouldering-pants-caramel-fw20?variant=39575475978307

Which of these is redirect? Plus, what's your primary domain? Isn't there redirect?

And have you tried using hashtag (#) instead of the first ($)?

 

Send me a link to your store to niki@ecommercepot.com and I'll help you out.
For more info what I do, visit my agency website ecommercepot.com or my personal website nikikozak.me.
KutokuTim
Tourist
5 0 4

Hey @Niki_K , thanks for responding!

Any URL that uses a variant query parameter will have all other query parameters stripped. This is not happening due to a redirect as I can see in Chrome's web inspector that the page's status is a 200. Here's a screengrab — https://share.getcloudapp.com/JruxdoZO

The site's Shopify domain is https://heddels.myshopify.com and this exhibits the same behaviour.

> And have you tried using hashtag (#) instead of the first ($)?

Can you clarify that? There are no $ signs in the URL.

Thanks!

Niki_K
Shopify Partner
447 45 124

Hi @KutokuTim,

I've just checked the page's status and I can see 200 as well. So, yeah this won't be the problem.

To the third point – I'm sorry, I wrote a wrong sign 😄 I meant using anchor character (#) instead of ampersand (&) before the utm_source -> .....#utm_source=........

Maybe the problem might be also in the analytics you're using? Are you using analytics.js or ga.js? Because by default, analytics.js will search for UTM parameters in both the query string and anchor of the current page’s URL, but ga.js won't. If I'm not mistaken, you have to allow it in the analytics, see the screenshot and here is also the link.

Snímek obrazovky 2021-10-05 v 19.25.01.png

 

 

 

Send me a link to your store to niki@ecommercepot.com and I'll help you out.
For more info what I do, visit my agency website ecommercepot.com or my personal website nikikozak.me.
KutokuTim
Tourist
5 0 4

Thanks again, @Niki_K 

> Maybe the problem might be also in the analytics you're using? Are you using analytics.js or ga.js? Because by default, analytics.js will search for UTM parameters in both the query string and anchor of the current page’s URL, but ga.js won't. If I'm not mistaken, you have to allow it in the analytics, see the screenshot and here is also the link.

Create info! I did not know this. However, unfortunately the param rewriting issue happens with any and all params (other than the variant param).

For example, this URL uses foo=bar and that will be removed too.

https://shop.heddels.com/products/bouldering-pants-caramel-fw20?variant=39575475978307&foo=bar

It's strange that this rewriting _only_ occurs when directly linking to a product that has variants. All other Shopify URLs seem to work fine. Do you think it's a theme issue?

EDIT

I also noticed this happens to other sites, for example — https://www.rogueterritory.com/collections/skinny-leg/products/sk-copper-selvedge-canvas?variant=330... — so it doesn't seem specific to our site.

Thanks!

Niki_K
Shopify Partner
447 45 124

Hi @KutokuTim,

thanks for update and finding out out that this is happening only for product variants and also, for other pages. 

  • Sure, the problem might be connected to theme. What could also work is this. If you have a product with a variant, you can see that the variant URL changes. If you choose size M, the variant URL xxxxxxx.com/collections/xxxxx?=123456789 is different to when choosing size L. So, the solution could be to remove the variants URL from the code. Then, I think you could use the UTMs parametr without problem because you would have only one default page. However, it has also a downsize – you won't be able to share the URL with the specific variant and not sure if this wouldn't mess up adding the products to cart. I found a thread in Shopify community, which discuss the variant URL. Maybe you could check it out? https://community.shopify.com/c/shopify-design/removing-product-variant-url-v/td-p/357768/page/2
  • The utm parameters are stripped because the page url includes the question mark and the equal sign and we don't know what other sign to use. 😄 

 

 

Send me a link to your store to niki@ecommercepot.com and I'll help you out.
For more info what I do, visit my agency website ecommercepot.com or my personal website nikikozak.me.
KutokuTim
Tourist
5 0 4

Hey @Niki_K 

Just to follow up on this. I believe I have resolved the issue. I have some code that requires a query param to exist in order to execute (and I thought this was not running because of the query param removal) but it turns out that this code executes _before_ Shopify's Javascript that re-writes the query params. So for us at least this is not an issue.

Really appreciate the assistance though. Thanks again!

Niki_K
Shopify Partner
447 45 124

Hi @KutokuTim,

okay! Great! Thanks for the update!

Send me a link to your store to niki@ecommercepot.com and I'll help you out.
For more info what I do, visit my agency website ecommercepot.com or my personal website nikikozak.me.
LuisGomesHM
Visitor
1 0 0

Hi @KutokuTim 

We are having the same issue and unfortunately Shopify Support says that it is not their scope of work. Could you please detail how you solved the issue?

Many thanks in advance

KutokuTim
Tourist
5 0 4

Hi @LuisGomesHM 

Well, we were lucky that the problem actually didn't affect us. We have a code snippet installed in the Shopify site's HTML. This code snippet requests a JS file and sends the query parameters along with that request. This request happens _before_ Shopify's code removes the query parameters so we were a bit lucky.

I do believe this is a Shopify issue and from their response to you it sounds like either don't want to fix it, or don't understand the problem.

Sorry I couldn't be more help.

EssEff
Shopify Partner
2 0 0

@KutokuTim Would it be possible for you to share the code snippet that you are using to avoid the issue? Thank you in advance!

freezecandy
Tourist
5 0 0

can you provide the code? 

goodlab
Visitor
1 0 1

Hi everyone, 

Did this ever get resolved. I tried all the combinations suggested here but nothing worked. In all cases, the URLs would change to the base shopify url with the variant code at the end.

I tried:
removing the variant part of the url
Add & after variant and before the start of UTMs
Add # after variant and before the start of UTMs

farpavilions
Visitor
1 0 0

I am facing same issue 

 

here is an example https://www.farpavilions.com/products/two-tone-white-washed-hand-carved-transitionall-arched-bookcas...

 

please correct the URL with UTMs so I can use in paid campaigns 

Lauv
Visitor
1 0 0

Hi, seems your link is working now. I could see the utm when I clicked the link. Did you make any changes? If yes, can you please share if you don't mind? Thank you

rohanrajpal
Shopify Partner
38 0 13

Facing exactly the same issue and none `#` `?` or `&` are working. Is it because of some shopify app or a theme issue?

 

Founder | meetspur.com
Feel free to reach out to me at howdyrohan@gmail.com or @rohanrajpal98 on Twitter
PeaceOut
Shopify Partner
8 0 3

Hey there, 

 

We have the same problem adding a URL parameter for affiliation purposes. In some cases, generally, a product variant, the affiliation param, and the UTM params would just be wiped ... This won't give the script the time to register this parameters  ... 

 

This sounds crazy that Shopify (or the app causing this problem) did not think about adding all the other parameters back after the Javascript URL cleanup. 

 

If I take the example on this website : 

https://www.farpavilions.com/products/two-tone-white-washed-hand-carved-transitionall-arched-bookcas...

 

The part "&test=test" is wiped of the URL! 

 

Why is this happening? for what purpose? As the variant remains the same. 

 

It's hard to think about using another character like "#" to fix the issue, as the whole system is based on query string (URL get params).

 

Anybody knows if this Javascript redirection is made by Shopify or an app ? 

 

Thanks in advance