Google Tag Manager example: Set promo code depending on prepayment
Storeganise does not offer support for GTM use or guarantee that any custom GTM code will work within Storeganise. Additionally, periodic updates to the Storeganise API could impact or even break how custom GTM code works. Please note also that many users may not see changes made via GTM due to the widespread use of ad-blockers.
<script>
var sp = new URLSearchParams(location.search);
if (sp.get('prepay') && !sp.get('code')) {
var code;
if (sp.get('prepay') >= 24) {
code = 'prepay-2y';
}
else if (sp.get('prepay') >= 12) {
code = 'prepay-1y';
}
else if (sp.get('prepay') >= 6) {
code = 'prepay-6m';
}
history.pushState({}, null, location.pathname + location.search + '&code=' + code)
}
</script>

