All jobs / Frontend / web developer / Security
Frontend / web developer interview question · 5+ years
How do you keep consent state consistent across web, a WebView, and a pixel manager?
The strongest answer
One consent store as the source of truth, purpose IDs, APIs for tag managers, and a sync into the WebView — no ad-hoc dual-write cookies
Why it works
Consent is a distributed state problem. One store, purpose-scoped, readable by GTM and the WebView bridge.
What a good answer covers
- One consent record, many surfaces.
- Purpose IDs, not a boolean.
- Tag manager and WebView read the same store.
- No cookies before grant — including WebViews.
Answers that fall short
- Close, but not the strongest: A separate banner per surface
Separate banners disagree and double-prompt. - Weak: A localStorage boolean accepted=true
A single boolean cannot express purposes or withdrawal. - Red flag: Share tracking cookies into the WebView before consent because it is 'our app'
A WebView is still a browser for cookie law.
Who gets asked this
More Security questions
- 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?
- Legal says marketing pixels cannot run before consent. How do you architect the frontend?
- A junior's PR works but has an XSS hole and no tests. How do you mentor in review?