Guides · Privacy and third parties

Trackers on arrival

One of the checks in every audibot report. This page says exactly what audibot reads, what passes, and how to fix it.

What audibot checks

The src of every <script> and <img> in the HTML the server sends, matched against a list of common advertising and analytics hosts: Google Analytics / Tag Manager, Google Ads, Meta Pixel, Hotjar, Microsoft Clarity, TikTok Pixel, LinkedIn Insight, X (Twitter) Pixel, Segment, HubSpot, Mixpanel and FullStory.

Why it matters

A tracker in the initial HTML runs before the visitor has agreed to anything. In the EU and UK, tracking that is not strictly necessary needs consent first.

How do I load analytics only after cookie consent?

Leave the tags out of the HTML and add them from script once the visitor has agreed — most consent tools can do this for you. Or use an analytics tool that does not set cookies or track across sites.

Load a tag after consent

function loadAnalytics() {
  const s = document.createElement('script')
  s.src = 'https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX'
  s.async = true
  document.head.append(s)
}

consentButton.addEventListener('click', () => {
  localStorage.setItem('consent', 'yes')
  loadAnalytics()
})
if (localStorage.getItem('consent') === 'yes') loadAnalytics()

Related tools

Other checks in Privacy and third parties

Privacy and third parties in the methodology ·All guides

This check is one step of the website launch checklist.

Check your site

audibot runs this check and every other one in a single audit, and publishes the report with a recommendation for each finding.