Can't include tracker via Google Tag Manager
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
Including the UXWizz tracking script via Google Tag Manager doesn't work.
Uncaught TypeError: Cannot read property 's' of undefined at ust.min.js?v=3.4.2:2
The issue occurs because when you include multiple scripts via GTM, the include order is not guaranteed.
<script>UST_CT = [];UST = { s: Date.now(), addTag: function(tag) { UST_CT.push(tag) } };UST.addEvent = UST.addTag;</script>
<script src="https://your.uxwizz.com/server/ust.min.js?v=x.x.x" async></script>
A quick solution is to use a single script tag and load ust.min.js dynamically like this:
<script>UST_CT = [];UST = { s: Date.now(), addTag: function(tag) { UST_CT.push(tag) } };UST.addEvent = UST.addTag;
var ust_min_js = document.createElement("script");
ust_min_js.src = 'https://your.uxwizz.com/server/ust.min.js?v=x.x.x';
document.head.appendChild(ust_min_js);
</script>
Make sure to replace https://your.uxwizz.com/server/ust.min.js?v=x.x.x
with the actual URL to your tracking file.