tagmanager-sentry

Sentry template for Google Tag Manager

APACHE-2.0 License

Stars
3

Sentry template for Google Tag Manager

Add sentry script to page. After Sentry init, the custom event "sentryLoaded" will be fired.

Find your project ID and public key in your project's settings page on Sentry:

─ projects
  └─ <PROJECT_NAME>
     └─ Client Keys (DSN)
        └─ Configure (button)
           ├─ Public Key (scroll down)
           └─ Project ID
  1. This template loads the Sentry SDK.
  2. Upon success - it calls on init with DSN built from your Key and Application ID.
  3. Finally - it fires a custom event, sentryLoaded to be picked up by other tags in your system.

An example custom tag configuring Sentry dimensions

<script>
Sentry.configureScope(function configureSentryScope(scope) {
  scope.setTag('page-type', {{page-type}});
  scope.setTag('pwa-mode', {{pwa-mode}});
});
</script>

Browse source code and tests in src directory