G Suite is now Google Workspace: everything your business needs to get work done.

JavaScript error trigger

Google Tag Manager's JavaScript error trigger is used to fire tags when an uncaught JavaScript exception (window.onError) occurs. This tag may be used to log error messages in an analytics tool. Use a JavaScript error variable to capture the error message and send the value of that variable when a tag fires.

To configure a JavaScript error trigger:

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

When the trigger fires, the following built-in variables are populated:

  • Error Message: The text of the JavaScript error message.
  • Error URL: The URL for the page where the error occurred.
  • Error Line: The line number in the code where the error was detected.
The JavaScript Error trigger will not report errors that occur before Tag Manager loads, and will only report uncaught exceptions.
Was this helpful?
How can we improve it?
Clear search
Close search
Google apps
Main menu
Search Help Center