Track JavaScript errors and Reduce Cart Abandonment Rate

These instructions are for sites that have upgraded to Universal Analytics (which you should do anyway to get access to new features sooner). Find out how to upgrade to Google Analytics or ask us to do it for you

Technical problems may not be the biggest issues when it comes to shopping cart abandonment but they still account for a large portion of the long tail of issues listed by shoppers. Fix it can really make a difference across to your bottom line.

Tracking JavaScript errors on your page (i.e. failing shipping calculator script) can give you a lot of insight as to why your. Again, you will need to set up a listener tag and fire and event when this listener tag captures a Javascript error.

Set Error Listener

Let’s first set up, the JavaScript Error Listener Tag:


Set Macro to Capture JS error message

We also need to create Macro for capturing JavaScript error message and another Macro for capturing the URL on which the error occurred.



Set Up Tag To Create An Event

Now let’s create a tag that will fire a Google Analytics event and pass the error message and error url:


and fire it when JavaScript Error Listener captures an error:


That’s it, just don’t forget to check your Google Analytics regularly for JavaScript Error events.

Hope this was helpful and don’t forget to Publish your Tag Manager Container!

If you find yourself stuck or having issues, contact us and we can help you troubleshoot.

Disclaimer: I used most of the material and ideas in this post from a post by @jevgenijs who first publish this tip on medium. All hail and glory to him. 

Leave a Reply