Hi, is there a way to not loose URL parameters? It appears that the page cache reloads the page and deletes them.
The goal is to track referrals from diffent ads we are placing throughout the internet.
Any advise or direction is appreciated.
I have been encountering this issue recently. From what I can gather it appears it seems like as soon as you hit the url with the parameters thats is whats cached. Any further attempts to view the same url but with different parameters looks like its gets redirected to the version with the parameters that where put in on the first visit.
This is proving to be a massive problem for our build, does anyone have an idea about why Shopify does this and if its possible to disable?
Where are you processing the URL parameters?
Shopify does cache, pretty safely, what's on the server side, and you'll be glad they do if you experiment with how slow your site performs when you bust that cache continually (try previewing a non-live theme, I think that will demonstrate). There's no access unfortunately to, for instance, add a parameter to the cache key yourself so that you could say, cache several versions of a page separately. They do bust their cache seemingly smartly, so I presume when for example a product changes or sells out they take care of busting the cache of collections that have the product, and the product pages themselves.
Typical practice is to process analytics things on the client side, where this server-side cache won't hurt you.
In other words, if I visit
and you visit
we could both get the same HTML from the server - but - client side scripts will still see our own unique values for myID and they can send them to your third-party analytics providers.
Its essentially for a product option preselection.
So you click through from a page that details something about the product, for examples sake say the colour red.
So on the 'Red' page it lists the products which can be bought in red, if you click on one of the related products when you go to that page the colour drop down would already be preselected to show red.
Its a fairly simple setup, in that we just append the colour onto the products url at the point that its displayed to the user within the related products section of the 'Red' page.
So on the 'Red' page the related products will have a url along the lines of: https://someshop.myshopify.com/collections/some-collection/products/some-product?colour=Red
So when you click though and get to the product page, JS kicks in, reads the url parameter and then just marks the drop down option as selected based on a simple text match.
We noticed though that this works fine on the first instance, however if you go back and repeat the process within what appears to be a random time limit it starts changing the url automatically to show the old parameters.
So second time around if you repeat the process but this time say go via the 'Green' page, the related product url will actually be https://someshop.myshopify.com/collections/some-collection/products/some-product?colour=Green but when you select it theres a chance that Shopify will 301 and redirect it to https://someshop.myshopify.com/collections/some-collection/products/some-product?colour=Red
What I really can't get my head around though is if you hit the url directly rather than clicking on the related product link, theres no 301 and it always works!?