Register
Login
Back to Blog
Address bar showing one domain while a framed page from a different site loads behind it

CNAME Cloaking: How It Works and Why Browsers Limit It

DeepClick
DeepClickPublished on November 27, 2026 in Tech Guides

What CNAME cloaking is

CNAME cloaking is a tracking setup in which a website points one of its own subdomains, such as metrics.example.com, at a third-party tracking vendor through a DNS CNAME record. To the browser, requests to that subdomain look first-party, so the vendor's server can read and set first-party cookies and is not caught by rules that only look for third-party tracker domains.

The name comes from the fact that the third party is "cloaked" behind the site's own domain. The technique has nothing to do with ad cloaking (showing reviewers different content from users); it is a measurement and privacy topic. It matters to advertisers because it affects how long click IDs and visitor cookies survive, and because regulators and browsers treat it as tracking, not as a neutral DNS choice.

How CNAME cloaking works, step by step

  1. The site owner creates a DNS record: metrics.example.com CNAME customer123.tracker-vendor.net.
  2. The page loads a script or pixel from metrics.example.com.
  3. DNS resolves the subdomain to the vendor's servers, but the browser still sees the request as same-site with example.com.
  4. The vendor's response sets a cookie on example.com through an HTTP Set-Cookie header, which the browser treats as a first-party cookie.
  5. Because the cookie is first-party and server-set, it historically escaped the limits browsers apply to third-party cookies and to cookies written by JavaScript.

WebKit's 2020 description of the technique is a good primary source: a first-party subresource "resolves through a CNAME that differs from the first-party domain", giving thirdParty.example "the same powers as the true first party".

How browsers and blockers respond

Defence

What it does

Scope

Safari Intelligent Tracking Prevention

Detects third-party CNAME (and third-party IP) cloaking and caps cookies set in those responses to 7 days

Safari on macOS and iOS since late 2020

Firefox + uBlock Origin

Resolves the real canonical name with the browser DNS API and blocks it if the vendor is on a filter list

Firefox only; "Uncloak canonical names" is on by default

Brave

Uncloaks CNAMEs natively and applies its tracker lists

Brave browser

Chrome extensions

Cannot see CNAME targets, because Chromium does not expose a DNS API to extensions

Chrome-based browsers

Safari's rule is specific. Its documentation says ITP caps cookie expiry to 7 days when a first-party subresource resolves through a CNAME that differs from both the first-party domain and the top frame host's own CNAME. A whole site served through an edge network or CDN is not penalised on that basis, and a subdomain pointing to the same edge as the main site is treated as first-party.

One recent change is worth knowing. In Safari 27.2 (October 2026), WebKit fixed a bug that had also capped cookies set by the page's own top-level response when the site's hostname was a CNAME to its host, a common setup on hosted stores and static hosting. That fix only covers the page's own response. Third-party CNAME cloaking stays capped at 7 days.

Why CNAME cloaking is a compliance issue, not just a technical one

Consent rules do not depend on the domain name. Under GDPR and the ePrivacy rules in Europe, and under comparable laws elsewhere, what matters is whether you store or read identifiers on a user's device and share data with a third party. Disguising a vendor as a subdomain does not change either fact. If the tracking needs consent, it still needs consent.

It can leak cookies you did not intend to share. Because the vendor's server sits on your domain, it can receive every cookie scoped to example.com, which may include session or login cookies. Security researchers have documented cases where CNAME-cloaked trackers received authentication cookies.

It undermines user choice. Users who install a blocker or pick a privacy-focused browser have stated a preference. Engineering around that preference is the kind of practice regulators and platform reviewers read as deceptive.

Legitimate alternatives for first-party measurement

You can keep accurate attribution without disguising third parties:

  • Server-side tagging on infrastructure you control. Run the collection endpoint on your own servers or a cloud project you own, apply consent decisions before forwarding events, and disclose the processors you forward to.
  • Conversion APIs. Meta's Conversions API, Google's enhanced conversions and TikTok's Events API send consented conversion data server-to-server instead of relying on long-lived browser cookies.
  • Short, honest cookie lifetimes. Design attribution windows around the cookie lifetimes browsers actually allow, rather than around ways to extend them.
  • Clear disclosure. List every vendor that receives data in your privacy notice and consent banner, including any that operate behind a subdomain.

For the broader picture of how attribution tools collect and match data, see our mobile ad attribution guide and link tracking for ad campaigns.

How to check whether your own site uses CNAME cloaking

Marketing teams often inherit a CNAME set up by a previous vendor. To audit:

  1. List your DNS records and look for subdomains such as metrics., data., t., stats. or smetrics. that are CNAMEs to a domain you do not own.
  2. Run dig +short CNAME metrics.example.com for each one to see the real target.
  3. Open your site in Firefox with uBlock Origin and check the logger for requests that are blocked after uncloaking.
  4. Check which cookies those subdomains set, and whether any are scoped to your root domain.
  5. Confirm each vendor appears in your consent tool and privacy notice, and that no session or login cookies are exposed to it.

If you find a cloaked tracker you no longer need, remove the DNS record and the tag. If you still need the vendor, move it behind a consent-gated server-side setup and disclose it.

FAQ

What is CNAME cloaking?

It is a setup where a site's subdomain is pointed at a third-party tracker through a DNS CNAME record, so the tracker's requests and cookies look first-party to the browser.

Is CNAME cloaking illegal?

The DNS record itself is not illegal. Using it to track users without the consent required by laws such as GDPR, or to share cookies users did not agree to share, can be. Hiding the vendor does not remove the consent requirement.

Does Safari block CNAME cloaking?

Safari does not block the request. Its Intelligent Tracking Prevention caps cookies set by third-party CNAME-cloaked responses to 7 days.

Can uBlock Origin detect CNAME cloaking?

Yes in Firefox, where it can resolve the real canonical name and block listed trackers. Not in Chrome, because Chromium does not give extensions a DNS API.

What is the difference between CNAME cloaking and ad cloaking?

CNAME cloaking disguises a tracking vendor as part of your domain. Ad cloaking shows platform reviewers different content from users, which every major ad platform prohibits. They share a word, not a mechanism. See domain cloaking explained for how the cloaking terms differ.

Summary

CNAME cloaking makes a third-party tracker look like part of your own site by routing a subdomain to it through DNS. Safari caps its cookies at 7 days, Firefox and Brave can uncloak it, and privacy law treats it as tracking regardless of the domain name. If you need durable measurement, use consented server-side collection and conversion APIs on infrastructure you control, and disclose every vendor that receives data.

Ready to Boost Your Ad Conversions?

See how DeepClick can improve your post-click performance.

© 2009, DeepClick Limited.
Email: contact@deepclick.com
Room 1508, Grand Plaza Office-Tower 2, 625 Nathan Rd, Mong Kok, Kowloon City, Hong Kong
Reflow Features
icon
Ad Fallback PageExclusive PageAudience RecoveryClaim ResolutionGreen ShieldPush NotificationsPWA Retargeting
Industry Solutions
icon
AI Social AppsGamingMeta & TikTok Advertisers
About Us
icon
Contact Sales
Join Us
Partners
Resource Center
icon
BlogAll Articles
API Document
Privacy PolicyUser Agreement