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.
Based on the example you sent:
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.
Just use this URL and it'll be fine:
Notice the & after the variant ID in the URL (bolded to show you).
I'm struggling with this issue too and the suggested solutions do not work. Take this URL:
If I add a utm_medium=email like so:
The utm_medium parameter is stripped (I believe by JS) and I end up at the original URL:
This happens with _any_ added query param other than variant.
Does anyone know how I can resolve this?
it's weird that it isn't working. It can be also because of some redirects:
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 ($)?
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.
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.
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.
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?
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 for update and finding out out that this is happening only for product variants and also, for other pages.
Really appreciate the assistance though. Thanks again!
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
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.
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.
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