Hey here is a way we can achieve the same
https://freakdesign.com.au/blogs/news/get-the-url-querystring-values-with-liquid-in-shopify
The discussion centers on extracting URL parameters in Shopify’s Liquid templating language, which lacks native support for this functionality.
Original Question:
A user asks how to capture URL parameters (e.g., ?parameter=value) and store them in Liquid variables.
Primary Use Case:
Multiple participants need to track affiliate parameters (specifically CJ Network’s cjevent) throughout the customer journey—from initial visit through checkout—to pass back to tracking pixels.
Solutions Provided:
Google Tag Manager + JavaScript approach: One user successfully implemented GTM with custom tags, triggers, and cookies to capture and persist the cjevent parameter. This solution includes detailed code for both Shopify Plus and non-Plus stores.
Third-party tutorial: A link to FreakDesign’s guide on extracting querystring values with Liquid.
Liquid workaround: A code snippet that parses content_for_header to extract URL parameters without JavaScript, which received positive feedback as a cleaner alternative to “ugly JS hacks.”
Status:
The thread provides working solutions but highlights that Shopify’s Liquid doesn’t natively support URL parameter access, requiring workarounds.
Hey here is a way we can achieve the same
https://freakdesign.com.au/blogs/news/get-the-url-querystring-values-with-liquid-in-shopify