Sub topic 4
Why Marketing Cookies and Pixels Need Consent
This chapter explains why most marketing technologies need the visitor's consent before they run. It assumes you already know the following:
- How web cookies work:
Set-Cookie, first-party and third-party cookies, and expiry. - What common marketing tools do: analytics, advertising pixels and tag managers.
- The basics of GDPR and personal data.
Earlier chapters covered the laws and the exemptions. Here they are applied to marketing.
The rule in brief
In the EU, Article 5(3) of the ePrivacy Directive (2002/58/EC) governs this area. Each member state implements it in its own law. In the UK, Regulation 6 of the Privacy and Electronic Communications Regulations (PECR) does the same job. Both say that a site must not store information on a visitor's device, or gain access to information already stored there, unless one of two things is true:
- The visitor has given consent.
- An exemption applies.
The exemptions are narrow. One covers technical transmission of a communication. The other covers storage or access that is strictly necessary to provide a service the visitor explicitly requested.
Marketing technologies almost never fit either exemption, so consent is the default. The rest of this chapter explains the reasoning.
What triggers the rule
Three features of the rule matter for marketing work.
It is about the device, not the data
The rule applies when you store or read something on the visitor's terminal equipment (their browser, phone or computer). It does not matter whether the information is personal data. A random ID with no name attached still triggers the rule.
GDPR or UK GDPR applies as well whenever the information is personal data. Online identifiers that single out a visitor usually are. Two regimes then apply to the same activity:
- The ePrivacy rule decides whether you may touch the device.
- GDPR decides whether you may process the resulting data, and it supplies the definition of valid consent.
It is technology neutral
The text says "storing information or gaining access to information", not "cookies". The EDPB's Guidelines 2/2023 on the technical scope of Article 5(3) confirm that the following all count:
- Cookies.
- Local storage and session storage.
- Device fingerprinting, where a script reads browser and hardware attributes to build an identifier.
- Tracking pixels, including those in emails.
- Mobile SDK identifiers and URL or link-decoration tracking in some designs.
A pixel is a small image or script request. It can look harmless because it only "calls a server". However, the request often carries or reads a device identifier, or it triggers a script that sets cookies. Where a pixel causes information to be stored on the device or read from it, the rule applies. A pixel in an email works the same way: opening the message causes the device to fetch the image, which reveals information from the device.
It applies to reading as well as writing
A script that only reads an existing cookie, such as an advertising ID set earlier by another service, still needs consent. Removing the line that sets the cookie does not fix this.
Why marketing fails the exemptions
The "strictly necessary" exemption is assessed from the visitor's point of view. The question is whether the visitor can get the service they explicitly asked for without the storage or access. The site owner's commercial interests do not count.
Regulators have applied this consistently, starting with the Article 29 Working Party's Opinion 04/2012 on the exemption. The result is that these purposes are not exempt:
- Advertising and retargeting. The visitor asked to read an article or buy a product, not to be profiled for ads.
- Cross-site tracking. It benefits the advertiser and the ad network.
- Conversion measurement for ad campaigns. It measures marketing performance and is not needed to deliver the page.
- Audience building and lookalike modelling. The data is collected to serve other purposes.
Compare cookies that do qualify: a session cookie that keeps items in a shopping basket, or a security cookie that defends against request forgery. Remove those and the requested service breaks. Remove a marketing pixel and the visitor notices nothing.
Two points of nuance matter.
- Bundling does not create necessity. If a cookie serves both a necessary purpose and a marketing purpose, the exemption does not cover the marketing purpose. Split the cookie, or ask for consent.
- Analytics is a grey area. In the EU, most regulators treat analytics as needing consent. Some, such as France's CNIL, accept a narrow exemption for strictly anonymous audience measurement. In the UK, the Data (Use and Access) Act 2025 adds new low-risk exceptions, including some statistical purposes. It does not add one for advertising. Check the commencement status for your date. Marketing attribution tied to advertising platforms stays on the consent side.
Common marketing technologies at a glance
| Technology | What it does | Triggers the rule? | Typical outcome |
|---|---|---|---|
| Advertising pixel (for example a social network retargeting pixel) | Sets or reads an ID to link visits to an ad profile | Yes | Consent needed |
| Third-party ad network cookie | Tracks the visitor across sites | Yes | Consent needed |
| Conversion tracking tag | Reports purchases back to an ad platform | Yes, if it stores or reads device data | Consent needed |
| Email open-tracking pixel | Reveals when and where a message was opened | Yes | Consent needed |
| Fingerprinting script | Builds an ID from browser attributes | Yes | Consent needed |
| Tag manager container | Loads other tags | The container alone may not; the tags it loads do | Gate the tags |
| Shopping basket cookie | Remembers items the visitor added | Yes, but exempt | No consent needed |
| Security or fraud-prevention cookie | Protects the visitor's session | Yes, but exempt | No consent needed |
A tag manager is a delivery mechanism. Loading Google Tag Manager is not the problem. The problem is what it loads, and when.
A decision flow
The last step in the diagram matters. Passing the device-access rule does not settle the GDPR question. You still need a lawful basis, transparency and the other GDPR duties for any personal data the tag collects.
Where the consent standard comes in
Article 5(3) and PECR Regulation 6 use the word "consent" and take its meaning from GDPR (Articles 4(11) and 7) or UK GDPR. A later chapter covers this in detail. For marketing tags it has one practical consequence. Consent must be:
- freely given,
- specific,
- informed,
- unambiguous, and
- given by a clear affirmative act.
Marketing cannot rely on legitimate interests for the device-access step. Legitimate interests is a lawful basis for processing under GDPR, but it cannot replace consent where Article 5(3) or PECR Regulation 6 requires it. This is a frequent error in privacy notices.
Enforcing it in code
The principle is simple: the marketing script must not exist on the page until the visitor opts in. This example comes from the tutorial's plan. It adds the script element only after a positive choice.
const consent = { marketing: false };
function loadMarketingPixel() {
const script = document.createElement('script');
script.src = 'https://example.com/marketing-pixel.js';
script.async = true;
document.head.appendChild(script);
}
function onConsentChange(choices) {
consent.marketing = choices.marketing === true;
if (consent.marketing) {
loadMarketingPixel();
}
}
// Nothing marketing-related is loaded until the visitor opts in.
// onConsentChange is called by the banner when the visitor saves choices.The key line is the strict comparison choices.marketing === true. Anything other than an explicit true, including a missing value, leaves marketing off. Silence is not consent.
This sketch only handles opting in. It does not remove a script already loaded when a visitor withdraws consent. A later chapter covers withdrawal and the full enforcement design.
Common errors
- Loading the tag, then asking. A pixel hard-coded in the page header fires before the banner appears. Moving the banner higher on the page does not help. The tag has to be absent, or held back, until the choice is made.
- Treating "no personal data" as a defence. The device-access rule does not depend on personal data.
- Relying on the vendor's claims. A vendor saying its cookie is "anonymous" or "essential" does not make it exempt. You assess it against the visitor-centred test above.
- Hiding marketing inside a necessary category. Putting an advertising cookie under "functional" to avoid a prompt is a recurring finding in regulator investigations.
- Forgetting emails and apps. Pixels in newsletters and SDKs in mobile apps fall under the same rule.
- Assuming a tag manager is exempt. The container may be harmless, but every tag inside it needs its own assessment.
Practical checklist for each marketing tag
- Does it store or read anything on the device (cookie, local storage, fingerprint, ID)?
- If yes, is it genuinely needed for something the visitor explicitly requested?
- If not, put it behind consent and document the purpose.
- Check whether the vendor adds further tags or calls other domains once loaded.
- Check whether the same tag also processes personal data under GDPR.
Exercise
A retailer adds a social network's advertising pixel to its checkout confirmation page. The pixel reads an advertising cookie and sends the order value to the network for campaign measurement. The retailer argues the pixel is "necessary because the checkout page cannot be measured without it". Does the retailer need consent, and why?
Show answer
Yes. The pixel reads information from the device (the advertising cookie), so Article 5(3) of the ePrivacy Directive or PECR Regulation 6 applies. The exemption for strictly necessary storage or access is judged from the visitor's side. The visitor asked to buy goods, and the checkout works without the pixel. Measuring campaign performance serves the retailer and the ad platform, not the visitor's request, so no exemption applies. The retailer must load the pixel only after the visitor has given valid consent. Because the pixel is also likely to process personal data, GDPR or UK GDPR obligations apply too.