Stitch Logged-Out Device Events to Accounts Before Measuring Signup Funnel

Last updated: November 29, 2026

Quick Overview

Instagram web events before login carry only a device cookie. Using a login mapping table, attribute pre-login events to the account that later logged in on that device, then compute the landing to signup-form to account-created funnel at the person level.

Meta
Data Manipulation (SQL/Python)
Data Engineer
Meta
November 29, 2026
Data Engineer
Onsite
Data Manipulation (SQL/Python)
Hard

0

0

0 solved


Instagram web events before login carry only a device cookie. Using a login mapping table, attribute pre-login events to the account that later logged in on that device, then compute the landing to signup-form to account-created funnel at the person level.

An identity-resolution plus funnel question in the style of Meta's onsite data engineering interviews. The interviewer checks that you map anonymous events to people with a clear rule for shared devices, avoid double counting people with many cookies, and keep never-converted devices as their own units.

What the Interviewer Expects
  • Defines a rule for which account a cookie maps to (first login after the event)
  • Keeps unmapped cookies as anonymous units in the funnel
  • Uses COALESCE to build a single person key
  • Handles shared devices without assigning one event to many accounts
  • Counts distinct person keys per step
Key Topics to Cover
identity stitching
anonymous to known
COALESCE key
ROW_NUMBER
funnel
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • What happens to the funnel if you map each cookie to its most recent account instead?
  • How would you handle a family computer where three people log in?
  • Why does stitching usually raise measured conversion?
  • How would you keep this mapping fresh in a daily pipeline?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

web_events(cookie_id, user_id, event_name, event_ts) where user_id is NULL before login, with steps landing_view, signup_form_view, account_created. logins(cookie_id, user_id, login_ts), w...

Approach

For each anonymous event, find candidate logins on the same cookie after it within 30 days and keep the earliest with ROW_NUMBER. That gives at most one account per event, which handles shared devic...


Submit Your Answer
Markdown supported