Right – got that. Now I want to give you some more POWER to help your debugging. Knowing the source of the exception if the source was another script is all well and good but what else was happening on the page in terms of the dataLayer when the exception happened?
I can see how such a tag could be used in many areas during development and testing. It may also have value to ops. Make sure you don’t inadvertently put any PII data in the dataLayer though!
See this example: DUH!Wrapping any script in a try/catch block will enable semantic exceptions to be caught programatically….but not syntax exceptions.
Call this after the pageview using the hitCallBack and your dataLayer failures will be recorded.