I’m trying to implement a tracking script in the additional scripts area of Shopify checkout settings. My goal is to capture the total number of items in the customer’s cart for analytics purposes.
The issue I’m facing is that Liquid template variables don’t seem to work properly in this section. I’ve tried using the standard Liquid syntax but the variable comes back empty when the page loads.
Here’s the code I’m attempting to use:
<script type='text/javascript' src='//analytics.trackingsystem.com/js/track.js?campaign_id=789&ad_id=321¶m1=¶m2=&quantity={{ cart.total_quantity }}'></script>
The script loads fine but the {{ cart.total_quantity }} part shows up blank instead of the actual cart quantity. Has anyone successfully used Liquid variables in checkout additional scripts? What am I missing here?