Third-Party Scripts and GDPR: What You Need to Consent To
Every script loaded from an external domain can be a GDPR issue. Learn which third-party tools need consent, which don't, and how to handle each category.
Why Third-Party Scripts Are a GDPR Risk
When you embed a third-party script — a chat widget, analytics tracker, or social media button — you're not just adding functionality to your site. You're potentially transmitting your visitors' IP addresses, browser fingerprints, and behavioral data to a third party, often without your users' knowledge or consent.
Under GDPR, you are the data controller. The third-party service is a data processor. If that script collects personal data without valid consent, you are liable — not the script provider.
Scripts That Always Need Consent
Analytics and Tracking
Any script that tracks user behavior across sessions requires consent:
- Google Analytics (
analytics.js,gtag.js) — sets persistent cookies, tracks users across sessions - Hotjar — session recording, heatmaps, full behavioral tracking
- Microsoft Clarity — session replay, behavioral analytics
- Mixpanel / Segment / Amplitude — event tracking, user identification
- Facebook Pixel — cross-site tracking, ad conversion measurement
Advertising and Retargeting
- Google Ads Conversion Tracking — links ad clicks to on-site behavior
- Facebook Pixel (again — it does both analytics and advertising)
- LinkedIn Insight Tag — professional data enrichment, retargeting
- TikTok Pixel, Pinterest Tag — behavioral tracking for ad targeting
Social Media Embeds
- Twitter/X "Tweet" buttons — Twitter loads tracking cookies when the button renders
- Facebook Like/Share buttons — sets Facebook cookies on your domain
- YouTube embeds —
youtube.com/embed/setsVISITOR_INFO1_LIVEand other marketing cookies
Use privacy-friendly alternatives for social and video:
- Replace YouTube embeds with a thumbnail + consent-gated player (e.g.,
youtube-nocookie.com) - Replace social share buttons with simple anchor links to share URLs (no script needed)
Scripts That Typically Don't Need Consent
Strictly Necessary
These scripts are required for core functionality and don't need consent:
- Cloudflare (
__cf_bm,cf_clearance) — bot protection and security, necessary for site operation - Stripe (
_stripe_mid) — required for payment processing - reCAPTCHA — bot and spam prevention (though data transfer to Google requires disclosure)
- Session management — your own login and authentication scripts
Privacy-First Analytics (No Consent Required)
Some analytics tools are designed to work without personal data:
- Plausible Analytics — no cookies, no personal data, no consent needed
- Fathom Analytics — cookieless tracking, GDPR-compliant by design
- Matomo (self-hosted with anonymization) — can be configured to not require consent
The key test: does the script set any cookie or collect any data that can identify an individual? If yes, consent is needed.
How to Handle Each Category
Option 1: Block Until Consent
Use a Consent Management Platform (CMP) or Google Tag Manager with Consent Mode to:
- Block all non-essential scripts by default on page load
- Load them only after the user clicks "Accept"
- Unblock them automatically when consent is given
Option 2: Remove Them
If a script isn't essential to your business, the simplest compliance path is not using it at all. Do you really need both Google Analytics and Hotjar? Evaluate each script's actual value versus its compliance burden.
Option 3: Replace With Privacy-First Alternatives
- Analytics: Plausible or Fathom instead of Google Analytics
- Video:
youtube-nocookie.comembeds instead of standard YouTube - Live chat: Configure Crisp or Intercom to not set cookies until consent
Auditing Your Scripts
Run a GDPR Fix scan to see every third-party script loading on your site, what cookies each sets, and whether they're blocked before consent. New plugins and CMS updates often silently add scripts — regular audits are the only way to stay on top of it.
Check your website now
Find out if your site has the issues described in this article. Free scan, results in minutes.
Scan Your Site — Free