Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

384 B
Raw Blame
const GTM_SIGNATURES = ['googletagmanager.com/gtm.js']

function scanGTM(html) {
  if (typeof html === 'string') {
    return GTM_SIGNATURES.some((signature) => {
      return html.includes(signature)
    })
  }

  return false
}

export function checkGTM(document) {
  if (typeof document === 'object') {
    return scanGTM(document.documentElement?.outerHTML)
  }

  return false
}