URL Parameters deleted due to cache

New Member
1 0 0

Hi, is there a way to not loose URL parameters? It appears that the page cache reloads the page and deletes them.

For example...


reloads as...


The goal is to track referrals from diffent ads we are placing throughout the internet.
Any advise or direction is appreciated.

Shopify Expert
9807 92 1560

This doesn't make a lot of sense. Cache doesn't reload or delete things and when I go to that first link the url remains in place.

I could be missing something obvious but what step am I missing to see the issue?

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
New Member
2 0 0

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?

5 0 0

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.


If what you're doing isn't really analytics but is changing what's on the page, you can still try to determine if this is something you could be doing with JavaScript on the client side? Assuming it's not security related it should be ok to do that. For example, say you're selling sports merch and you want to showcase a Yankees logo for some people and a Red Sox logo for others, you could include both options in the liquid, but hidden. Then you can check for a URL parameter like "favoriteTeam" on the client side and toggle the desired one to be visible. Obviously this will have scaling problems - a larger page than necessary if you had tons of teams and a lot of content per team, but you can solve that by using the REST API to fetch content after page load that are relevant based on the URL params that are present.

New Member
2 0 0

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!?