Sub topic 12
Privacy and consent when you collect data
The website is the hub because it is where visitor data is collected. Analytics tags, advertising pixels, lead forms and the CRM handoff all gather information about people. This chapter covers the rules and design habits that keep that collection lawful and trustworthy.
This chapter assumes you have read the earlier chapters on UTM tagging, analytics and lead capture. It also assumes you can read short HTML and JavaScript snippets. It is a working guide for marketers and site owners. It is not legal advice, and the rules differ by country, so check your own situation with a qualified adviser.
What counts as personal data
Personal data is any information that relates to an identified or identifiable person. The test is whether you, or someone you share data with, could reasonably single the person out. Many marketing identifiers meet that test even though they contain no name:
- Email addresses, phone numbers and names collected in forms.
- IP addresses.
- Cookie IDs, device IDs and advertising IDs.
- Behavioral records tied to those identifiers, such as pages viewed or purchases made.
Anonymous, aggregated data, such as "4,200 sessions came from email last week", is generally outside these rules. The line is not always clear. A dataset that is "anonymous" but can be joined back to a CRM record by an ID is personal data.
The main legal frameworks
You do not need to memorize statutes. You need to know which model applies to your visitors, because it decides when tracking may start. Location of the visitor, not the location of your company, usually decides this.
| Framework | Region | Default model for marketing tracking | Notable features |
|---|---|---|---|
| GDPR and ePrivacy rules | EU/EEA (the UK has its own equivalents) | Opt-in: get consent before non-essential cookies or similar tech | Needs a lawful basis for processing; strong rights of access and deletion |
| CCPA/CPRA and similar US state laws | California and other US states | Mostly opt-out: tell people, let them refuse sale or sharing | "Do Not Sell or Share" link; honoring opt-out signals such as Global Privacy Control |
| Other national laws (for example Brazil's LGPD, Canada's PIPEDA) | Various | Varies, often consent-centered | Check each market you target |
If you serve visitors from several regions, the simplest policy is to apply the strictest model to everyone. The alternative is to detect region and vary the banner. That adds complexity and risk of misdetection.
Consent versus other lawful bases
Under GDPR, consent is one of several lawful bases for processing. Two others matter for marketing sites:
- Contract: you need the data to deliver what the person asked for, such as an email address to send an order confirmation.
- Legitimate interests: you have a real business reason, and you weigh it against the person's rights. It can cover some low-risk uses, but it does not remove the separate ePrivacy requirement for consent before storing or reading non-essential cookies on the device.
Valid consent has four qualities. It must be freely given, specific, informed and unambiguous. In practice this rules out several common patterns:
- Pre-ticked boxes.
- Continuing to scroll as "agreement".
- Bundling several purposes into one "I agree".
- "Cookie walls" that block the whole site unless the visitor accepts tracking.
- Making "Reject" harder to find than "Accept".
Withdrawing consent must be as easy as giving it. Offer a persistent link, such as "Cookie settings" in the footer.
Cookies and the cookie categories
A cookie is a small piece of data the browser stores for a site. Banners usually sort cookies and similar technologies, such as local storage, pixels and fingerprinting, into categories:
| Category | Examples | Consent needed (opt-in regions) |
|---|---|---|
| Strictly necessary | Session login, shopping cart, security tokens | No |
| Preferences | Language, saved settings | Often yes, unless strictly needed for a requested feature |
| Analytics | Visit counting, funnel measurement | Generally yes |
| Marketing | Ad retargeting pixels, cross-site tracking | Yes |
Categories are about purpose, not cookie name. A cookie that does two jobs belongs in the stricter category.
How consent gates your tags
The key technical rule is that non-essential tags must not fire until the visitor opts in. Loading the analytics script first and "hiding" the data later does not satisfy this. The script may already have set a cookie or sent a request.
Most sites use a consent management platform (CMP) to handle this. A CMP shows the banner, stores the choice and tells your tag manager which tags may run. Here is the same idea written by hand. It shows what the platform does on your behalf:
const CONSENT_KEY = "consent_v1";
const POLICY_VERSION = "2026-11";
function readConsent() {
const denied = { analytics: false, marketing: false };
// Honor Global Privacy Control as an opt-out of marketing.
const gpc = navigator.globalPrivacyControl === true;
try {
const saved = JSON.parse(localStorage.getItem(CONSENT_KEY));
if (!saved || saved.policyVersion !== POLICY_VERSION) {
return denied; // no choice yet, or the policy changed: ask again
}
return { ...saved, marketing: saved.marketing && !gpc };
} catch (e) {
return denied;
}
}
function saveConsent(choices) {
const record = {
analytics: Boolean(choices.analytics),
marketing: Boolean(choices.marketing),
timestamp: new Date().toISOString(),
policyVersion: POLICY_VERSION,
};
localStorage.setItem(CONSENT_KEY, JSON.stringify(record));
applyConsent(readConsent());
}
function loadScript(src) {
const s = document.createElement("script");
s.src = src;
s.async = true;
document.head.appendChild(s);
}
function applyConsent(consent) {
if (consent.analytics && !window.analyticsLoaded) {
window.analyticsLoaded = true;
loadScript("https://www.example.com/analytics.js");
}
if (consent.marketing && !window.pixelsLoaded) {
window.pixelsLoaded = true;
loadScript("https://www.example.com/ad-pixel.js");
}
}
applyConsent(readConsent());The default is denial. Nothing loads unless a stored, current choice allows it. The record includes a timestamp and policy version, so you can show later what the visitor agreed to.
Consent signals in analytics tools
Some analytics and advertising platforms offer a consent mode. The tag loads in a restricted state and sends limited, cookie-free pings until consent is granted. Check two things before relying on it. First, whether the restricted mode is acceptable under your regulators' view of the rules. Second, whether the modeled data it produces is good enough for your KPIs.
Expect measurement gaps. When visitors reject tracking, your analytics undercount sessions and conversions, and channel attribution gets less precise. Report with that in mind. Compare trends over time rather than treating absolute numbers as exact, and use first-party sources, such as your own order database, to cross-check key totals.
Privacy in the rest of the hub
Consent banners are only one part. Privacy affects every earlier chapter's practice.
UTM parameters
UTM parameters appear in URLs. URLs are logged by servers, analytics tools, browsers and third-party scripts. Never put personal data in them:
Bad: https://www.example.com/offer?utm_source=newsletter&[email protected]
Good: https://www.example.com/offer?utm_source=newsletter&utm_medium=email&utm_campaign=spring_saleThe same applies to any query string, such as order or user IDs passed to a thank-you page.
Lead forms
A lead form is a point of collection, so it needs a clear purpose statement and a link to the privacy notice. Marketing opt-in should be a separate, unticked checkbox, not a condition of getting the download:
<form action="/subscribe" method="post">
<label for="email">Email address</label>
<input id="email" name="email" type="email" required>
<label>
<input type="checkbox" name="marketing_consent" value="yes">
Send me monthly marketing emails about garden tools and plants.
</label>
<p>
We use your email to send the guide. See our
<a href="/privacy">privacy notice</a> for how we handle your data.
</p>
<button type="submit">Get the free guide</button>
</form>Ask only for the fields you need. Each extra field must be justified (this is called data minimization), and each one lowers conversion as well.
CRM handoff
When the form posts to your CRM, send the consent evidence along with the contact. Store these fields:
- The consent status for each purpose.
- The timestamp.
- The source page or form.
- The version of the wording the person saw.
Without this, you cannot prove consent later. Also use the CRM to enforce choices: unsubscribed or non-consenting contacts must be excluded from marketing sends.
Third parties
Every vendor that receives visitor data, such as analytics, ad platforms, email tools and CRMs, is a processor or a separate controller. Keep a list. Have a data processing agreement with each processor. Check where data is stored and whether international transfers need extra safeguards. An unreviewed tag added by someone in the marketing team is one of the most common compliance failures.
Visitor rights and retention
In many regions, people can ask to see their data, correct it, delete it, or object to marketing use. Plan an internal process for these requests: who receives them, where the data lives, and how quickly you must answer (often within a month under GDPR). Set retention limits too. Configure your analytics tool to expire old user-level data, and remove stale leads from the CRM.
Common mistakes
- Firing analytics and ad tags before the banner is answered.
- A banner with a prominent "Accept" and a hidden "Reject".
- Testing the site only after consent, so no one notices tags fire early.
- Keeping a consent choice forever even though the policy or tag set changed.
- Using a purchased email list for marketing without valid consent from the people on it.
- Copying a privacy notice from another company that does not describe your actual tools.
Test regularly. Open the site in a private window, decline everything, and check the browser's developer tools network and cookie views. No analytics or marketing requests or cookies should appear.
Exercise
Your newsletter links use utmcampaign=springsale, and your site loads an analytics script in the page head. A visitor in the EU opens a link and ignores the cookie banner. Does the analytics script load? Name one change that fixes it if it does.
Show answer
It should not load. In an opt-in region, non-essential analytics requires consent, and ignoring the banner is not consent. If the script is in the page head and loads unconditionally, move it behind a consent gate. Load it through your CMP or tag manager only after the visitor accepts the analytics category. The UTM parameters are not the problem, since they hold no personal data, but the analytics tool that reads them must wait for consent.
Exercise
A colleague wants a landing page form with the marketing-email checkbox pre-ticked and a hidden field that adds the contact's email to the thank-you page URL for conversion tracking. Identify two problems and a fix for each.
Show answer
First, a pre-ticked box is not valid consent, which must be an unambiguous, active choice. Leave the checkbox unticked and make it a separate, specific opt-in. Second, putting the email in the URL exposes personal data to server logs, analytics and third-party scripts. Fire the conversion event without personal data, for example with a generic "lead_submitted" event, or pass a non-identifying reference and keep the email in the CRM.
Exercise
After consent rates fall, your analytics shows fewer sessions from paid social. Does this mean the channel got worse? What do you check?
Show answer
Not necessarily. Rejected tracking removes visitors from analytics, so reported sessions and conversions fall even if real traffic did not. Compare against first-party numbers, such as orders in your own database and the ad platform's click counts. Check the consent rate by period, and compare trends and ratios (for example conversion rate among consenting visitors) rather than absolute totals before judging the channel.