← Meta Interview Insights

Meta·Data Scientist·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

SQL-heavy technical screen for a DS role at Meta, focused entirely on Ads Pixel analytics. Two back-to-back query problems, both requiring you to think through weighted averages and bucketing logic under the hood. No behavioral, no product sense, just write the SQL and explain your choices.

Questions Asked (2)

Q1

Given tables for advertisers, pixels, and daily pixel signal data, write a SQL query returning one row per advertiser per day showing: number of active pixels (those with at least one event), total events received, and an event-weighted average valid event rate across active pixels.

Product Analytics & MetricsData Modeling
Author's notes

The active pixel filter tripped me up a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and definitions (e.g., what constitutes an active pixel, valid event rate). Then, write a query that joins the tables, filters for active pixels, and aggregates per advertiser per day using conditional aggregation for the weighted average. Finally, validate the logic with edge cases like zero events or null rates.

Pro tip: Explicitly state your assumptions about the data model (e.g., grain of each table, how to handle missing days) before writing SQL—this shows you think like a data scientist who cares about data quality and reproducibility.

1. Clarify schema and definitions

Ask about the columns and relationships: advertisers (advertiser_id), pixels (pixel_id, advertiser_id), daily_pixel_signals (pixel_id, date, events, valid_events). Define 'active pixel' as having at least one event that day, and 'valid event rate' as valid_events / events.

2. Filter and aggregate at pixel-day level

From daily_pixel_signals, filter to rows where events > 0 (active pixels). Compute per pixel per day: events and valid_events (or valid rate).

3. Join with advertisers and aggregate per advertiser-day

Join the filtered pixel-day data with pixels to get advertiser_id, then group by advertiser_id and date. Count distinct pixel_id for active pixels, sum events, and compute weighted average valid rate as SUM(valid_events) / SUM(events).

4. Handle edge cases and finalize query

Ensure no division by zero (e.g., use NULLIF or CASE). Consider advertisers with no active pixels that day—decide whether to include them with zeros or exclude. Write the final SQL with proper aliases and ordering.

Key Points to Mention

  • Definition of active pixel: at least one event on that day.
  • Event-weighted average valid event rate: SUM(valid_events) / SUM(events) across active pixels.
  • Use of conditional aggregation or subqueries to filter active pixels before aggregation.
  • Handling of NULLs or zero events to avoid division by zero.
  • Importance of grouping by advertiser_id and date to get one row per advertiser per day.
  • Potential need to join tables correctly to associate pixels with advertisers.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Extend the previous query to study how pixel signal quality relates to ad performance. Define a per-advertiser daily quality score (event-weighted average of valid_event_rate times match_rate), bucket each advertiser-day into low, medium, or high quality tiers, then aggregate spend, clicks, conversions, CVR, and ROAS by bucket across the 30-day window.

Product Analytics & MetricsA/B Testing & ExperimentationData Modeling
Author's notes

This one was harder to hold in my head all at once.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the per-advertiser daily quality score as the event-weighted average of valid_event_rate times match_rate, then bucket advertiser-days into low, medium, and high tiers using thresholds like tertiles or business-defined cutoffs. Finally, aggregate spend, clicks, conversions, CVR, and ROAS by bucket across the 30-day window, ensuring proper weighting and handling of edge cases.

Pro tip: When defining quality tiers, avoid arbitrary thresholds; instead, use quantile-based bucketing (e.g., tertiles) to ensure balanced groups and interpretability. Also, consider that ROAS and CVR should be computed as weighted averages (e.g., total conversions / total clicks) rather than averages of ratios.

1. Define the quality score

Compute a per-advertiser daily quality score as the event-weighted average of valid_event_rate * match_rate. Ensure you have the necessary event-level data and that weights are appropriate (e.g., by impressions or events).

2. Bucket advertiser-days into tiers

Assign each advertiser-day to a low, medium, or high quality tier based on the quality score. Use quantile-based thresholds (e.g., tertiles) or business-defined cutoffs, and document the rationale.

3. Aggregate metrics by bucket

For each quality tier, aggregate spend, clicks, conversions, CVR, and ROAS across the 30-day window. Compute CVR as total conversions / total clicks and ROAS as total revenue / total spend to avoid ratio bias.

4. Validate and interpret

Check for data quality issues, outliers, and ensure the aggregation is correct. Interpret the results to see if higher quality tiers correlate with better ad performance metrics.

Key Points to Mention

  • Event-weighted average: weight by the number of events (e.g., impressions) to accurately reflect the advertiser's daily quality.
  • Bucketing strategy: use quantiles (e.g., tertiles) to create balanced tiers, or align with business definitions of low/medium/high quality.
  • Aggregation: compute CVR and ROAS as weighted averages (total conversions / total clicks, total revenue / total spend) rather than simple averages of ratios.
  • Time window: ensure the 30-day window is consistent and that daily scores are aggregated correctly across days.
  • Data granularity: the query should operate at the advertiser-day level before bucketing, and then aggregate to the bucket level.
  • Potential confounders: consider that advertiser size or category might influence both quality and performance; mention the need for further segmentation or control.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.