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 14 (14)
Niki_K
Shopify Partner
258 27 74

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@hey.com and I'll help you out.
For more info what I do, visit nikikozak.me
Josh_Uebergang
Shopify Expert
806 24 200

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
258 27 74

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@hey.com and I'll help you out.
For more info what I do, visit nikikozak.me
KutokuTim
Tourist
5 0 1

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
258 27 74

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@hey.com and I'll help you out.
For more info what I do, visit nikikozak.me
KutokuTim
Tourist
5 0 1

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
258 27 74

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@hey.com and I'll help you out.
For more info what I do, visit nikikozak.me
KutokuTim
Tourist
5 0 1

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
258 27 74

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@hey.com and I'll help you out.
For more info what I do, visit nikikozak.me