1

I've read this article: https://support.google.com/tagmanager/answer/7679411?hl=en

It's pretty straight forwards:

To configure a JavaScript error trigger:

Click Triggers and then New.
Click Trigger Configuration and choose the JavaScript Error trigger type.

But my question is, now that I have set up a trigger, do I need to do something else to ensure it is passed to Google Analytics?

And where will it appear so I can test it is working?

5

Yes, the article is not quite complete. Any trigger has to be matched with a tag, in this case a Universal Analytics Event tracking tag (I do not believe there is another appropriate way to send it). Ours had the following values:

Category: JavaScript Error

Action: {{Error Message}}

Label: {{Error Line}}: {{Error URL}}

I say "had" because we have discontinued this tracking. It generated a lot of useless hits (things like Action: Script error., Label: 0:), and a whole lot of hits total, many of which were errors we couldn't do anything about because they were from 3rd-party scripts.

You may find it more useful, but I recommend that, if possible, you send these events to a different GA property. If you don't have one, consider filtering them out of your main view and using them in your unfiltered view or a dedicated error view.

| improve this answer | |
  • Great advice, thank you. I would hope not to have any errors, but on the odd occasion I did have it would be useful to know about them. – Eoin Jan 29 at 12:25
  • As a side question, can I simply do console.error("My test error"); in the console and generate an error to test? – Eoin Jan 29 at 12:48
  • Unfortunately I don't think console.error is caught as a JS error - you can try it, but if I remember correctly ours never showed up in GA. They were just differently-colored console.log messages. – Reve Jan 29 at 13:52
  • No, you're right. It's using window.onload and since my window is not loading, that would mean it doesn't show up. Thanks for your help. I'll generate an error in the code and then it should show. – Eoin Jan 29 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.