All jobs / Frontend / web developer / Security
Frontend / web developer interview question · 5+ years
Legal says marketing pixels cannot run before consent. How do you architect the frontend?
The strongest answer
A CMP gate: load tags only after purpose consent, honor region and withdrawal, and set no marketing cookies before that
Why it works
Consent is a load-order problem. Pixels are code; they do not run until the purpose is granted.
What a good answer covers
- Consent before tags.
- CMP as the gate.
- Purpose IDs, not one boolean.
- Withdrawal unloads tags and clears that purpose.
Answers that fall short
- Close, but not the strongest: A banner that does not block the pixels
A non-blocking banner is not consent. - Weak: Load the pixels and delete cookies if they opt out later
Deleting later does not undo the first send. - Red flag: Dark-pattern the accept button and ignore withdraw
Dark patterns and ignored withdraw are legal and trust failures.
Who gets asked this
More Security questions
- A junior's PR works but has an XSS hole and no tests. How do you mentor in review?
- How do you keep consent state consistent across web, a WebView, and a pixel manager?
- Marketing wants to render a CMS HTML snippet in React. Strongest answer?
- A cookie-session SPA posts state-changing requests. What do you do in the browser about CSRF?
- Auth token in localStorage versus an httpOnly cookie for a SPA — how do you argue it?
- You need a small inline boot script but CSP forbids unsafe-inline. What do you do?
- Two 401s trigger two refresh calls and one of them logs the user out. How do you design the client?
- Product wants full click tapes plus form field values in the frontend logger. How do you respond?