PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates a candidate's competency in event-level data manipulation and metric computation using SQL or Python, including time-based aggregation, deduplication, and joining or windowing of event streams.

  • Medium
  • TikTok
  • Data Manipulation (SQL/Python)
  • Data Scientist

Calculate Conversion Rate from Ad Clicks to Page Visits

Company: TikTok

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Technical Screen

user_events | user_id | event_time | event_type | ad_id | |---------|----------------------|------------|-------| | 1 | 2023-01-01 10:00:00 | ad_click | 101 | | 1 | 2023-01-01 10:05:00 | page_visit | NULL | | 2 | 2023-01-01 11:00:00 | ad_click | 102 | | 3 | 2023-01-01 11:30:00 | page_visit | NULL | | 2 | 2023-01-01 11:15:00 | page_visit | NULL | ##### Scenario An online advertising platform wants to measure how well ad clicks convert into subsequent page visits. ##### Question Given the user_events table, write SQL that computes the overall conversion rate defined as the share of ad_click events that are followed by at least one page_visit by the same user on the same calendar day. Clearly state the numerator and denominator you use in the metric definition. ##### Hints Use distinct user_id and event_type, date truncation, and a left join or window functions to link clicks to visits.

Quick Answer: This question evaluates a candidate's competency in event-level data manipulation and metric computation using SQL or Python, including time-based aggregation, deduplication, and joining or windowing of event streams.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Find high-value crypto users and top-CTR product - TikTok (easy)
  • Write monthly customer and sales SQL queries - TikTok (easy)
  • Find top-paid employee per department - TikTok (easy)
  • Count buggy vs non-buggy by employer - TikTok (Medium)
  • Select max-discount product per category - TikTok (Medium)