I am using a SERVER-SIDE TRACKING for my woocommerce site.
In there I added a JS Tracking code snippet provided by company to the wp_head using
JavaScript
x
<script>
add_action('wp_head', array(
$this,
'tracking_code'
));
</script>
, and
JavaScript
<script>
_xxx.push({
"track" : "pageview",
});
</script>
for all other events. All other events are working fine, but when I tried to fire the add to cart, it show the error :
Uncaught ReferenceError: _jts is not defined at ?add-to-cart=12:3:13
What can be the solution for this? Thanks for your time
Advertisement
Answer
The issue was the _xxx.push was loaded before the library loaded, fixed after added to footer.