CS custom code

 avatar
unknown
javascript
a year ago
1.1 kB
13
Indexable
<script>
(function () {
    window._uxa = window._uxa || [];
    try {
        if (typeof dataLayer !== 'undefined') {
            for (var i = 0; i < dataLayer.length; i++) {
               window._uxa.push(['setCustomVariable', 1, 'page_type', XXXX, 3]);
                if (event === view_item ) {
                  window._uxa.push(['setCustomVariable', 2, 'product_type', XXX, 3]);
               }
               window._uxa.push(['setCustomVariable', 3, 'user_status, XXX, 3]);
            }
        }
    } catch(e){}
    if (typeof CS_CONF === 'undefined') {
        window._uxa.push(['setPath', window.location.pathname+window.location.hash.replace('#','?__')]);
        var mt = document.createElement('script'); mt.type = 'text/javascript'; mt.async = true;
        mt.src = '//t.contentsquare.net/uxa/{{YOUR_TAG_ID}}.js';
        document.getElementsByTagName('head')[0].appendChild(mt);
    }
    else {
        window._uxa.push(['trackPageview', window.location.pathname+window.location.hash.replace('#','?__')]);
    }
})();
</script>
Editor is loading...
Leave a Comment