Sub topic 4
Why Marketing Cookies and Pixels Need Consent
This chapter assumes you know how web cookies work, you have used tools such as analytics, advertising pixels and tag managers, and you know the basics of GDPR and personal data. It explains why marketing technologies need consent under EU and UK law, and where people most often get this wrong.
The rule in one sentence
Storing information on a visitor's device, or reading information already stored there, needs the visitor's consent. This applies unless an exemption covers it. The rule comes from Article 5(3) of the ePrivacy Directive in the EU and from regulation 6 of PECR in the UK. The previous chapters covered scope and exemptions. This chapter applies them to marketing.
Two points follow from this wording:
- The rule covers access to the device. It does not matter whether the data is personal data.
- The rule applies when the cookie is set or read. It does not wait until someone uses the data later.
Why marketing fails the exemption test
The "strictly necessary" exemption covers storage that is essential to deliver a service the visitor asked for. Regulators read this narrowly. Marketing is there to serve the site owner's commercial aims, so it does not meet the test.
| Technology | Typical purpose | Consent needed? |
|---|---|---|
| Session cookie for a shopping basket | Keep items in the basket | No, strictly necessary |
| Advertising pixel (for example a social network pixel) | Measure ad conversions, build audiences | Yes |
| Retargeting cookie | Show ads to past visitors | Yes |
| Affiliate tracking cookie | Credit a referring partner | Yes |
| Tag manager container that only loads necessary tags | Deliver site functions | Usually no, but check what it loads |
The first row is the only one that passes, because the visitor cannot get the basket without it.
Pixels and fingerprinting count too
A tracking pixel is a tiny image or script that makes the browser send a request to a third party. Many pixels set a cookie. Some do not. Even without a cookie, the pixel may read device details such as screen size, browser data or an identifier in local storage. The rule is written to cover "similar technologies", so these cases also need consent when they access information on the device.
Server-side tagging does not remove the duty. If the browser still runs a script that reads the device, or sets a first-party identifier for marketing, consent is still needed.
The common errors
- Treating analytics as exempt. In most cases, analytics that profile visitors across visits need consent. Regulators have allowed a few narrow, low-risk exceptions. Check your regulator's current guidance before relying on one.
- "Legitimate interests" as a substitute. You cannot use legitimate interests for the device-access step. Consent is required there. You may need a GDPR lawful basis for the later processing as well.
- Loading first, asking later. A banner is not enough if the pixel fires on page load.
- Assuming the vendor handles it. The site operator controls what runs on the page and carries responsibility. A later chapter covers shared responsibility.
How the flow should work
The pixel must not run until the visitor opts in. This sequence shows the order:
The code below shows the same idea. The marketing script is added to the page only after the visitor opts in, so no marketing cookie is set earlier.
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.Note the strict check choices.marketing === true. Anything other than an explicit yes leaves the pixel off, which matches the rule that silence is not consent.
Checking a tool yourself
For any marketing tool, ask these questions:
- Does it store or read anything on the device, including cookies, local storage or fingerprint signals?
- Is that access essential for something the visitor asked for?
- If not, can it be switched off until the visitor opts in?
If the answer to question 2 is "no", you need consent before the tool runs.
Exercise
Your site adds an advertising pixel that sets no cookie. It reads a device identifier from local storage and sends it to an ad network. Does it need consent, and why?
Show answer
Yes. The consent rule covers any storage of or access to information on the device, not only cookies. Reading an identifier from local storage for advertising is not strictly necessary for the service the visitor requested, so no exemption applies and the pixel must wait for opt-in.
Exercise
A colleague says the marketing pixel is covered by legitimate interests under GDPR, so no banner choice is needed. What is wrong with this?
Show answer
The device-access step is governed by the ePrivacy rules (PECR in the UK), which require consent. Legitimate interests cannot replace consent for that step. It may still matter for later processing, but only after consent has been obtained for the cookie or pixel.