Last updated

Google Tag Manager analytics

Integrate Google Tag Manager into Redocly project.

Configuration

OptionTypeDescription
includeInDevelopmentbooleanSet this option to true to enable GTM Analytics in development mode and preview builds. Default is false.
trackingIdstringREQUIREDGTM tracking ID
gtmAuthstringGTM environment auth string
gtmPreviewstringGTM environment preview name
defaultDataLayerobjectArbitrary datalayer object to be set before GTM is loaded
dataLayerNamestringName of GTM datalayer
enableWebVitalsTrackingbooleanEnable web vitals tracking
selfHostedOriginstringSet this for custom GTM server hosting
pageViewEventNameStringSet this option to change the event name for page views. Default is pageView.

Example

analytics:
  gtm:
    includeInDevelopment: true
    trackingId: my-tracking-id
    gtmAuth: my-gtm-auth-string
    gtmPreview: my-gtm-preview-name
    defaultDataLayer:
      platform: redocly
    dataLayerName: my-data-layer-name
    enableWebVitalsTracking: true
    selfHostedOrigin: http://my-gtm-server-host.com
    pageViewEventName: routeChange