Skip to content
tezvyn:
Menu

Investigating analytics vs database count gaps

Source: interviewMediumHow cards are made

Summary

Data-quality debugging.

Key points

Causes include ad-blocker loss, differing identity logic, timezone mismatches, filtering, and pipeline delay; investigate by aligning definitions and tracing one user.

Watch out for

Trusting one source blindly.

WHAT THIS TESTS Whether you debug data discrepancies systematically, recognizing that the two systems usually measure different things rather than one being wrong.

A GOOD ANSWER COVERS The discrepancy almost always comes from definitional and collection differences. Collection loss: a product analytics tool relies on client-side events, so ad blockers, privacy settings, offline or closed sessions, and failed network beacons silently drop events, undercounting versus the backend. Identity and deduplication: the analytics tool may count anonymous and identified users differently, merge or fail to merge identities, or dedupe on a different key than the database, inflating or deflating counts. Time semantics: timezone differences such as UTC versus local, day-boundary cutoffs, and event-time versus ingestion-time can shift counts between buckets. Filtering: the analytics tool may exclude bots, internal IPs, or test accounts that the database includes, and vice versa. Sampling: some tools sample high-volume data. Pipeline latency: events still in transit or buffered have not landed yet.

SYSTEMATIC INVESTIGATION First, align definitions: are both counting the same entity, distinct users, over the same exact time window in the same timezone, with the same filters? Most gaps vanish here. Second, reconcile a single known user end to end: pick one user id, confirm their events exist in both systems and are counted identically. Third, quantify each contributing factor such as ad-block rate, bot filtering volume, and in-flight events to attribute the remaining gap. Fourth, check pipeline health and sampling settings.

COMMON WRONG ANSWERS Assuming the database is ground truth and the analytics tool is broken. Comparing different time windows or timezones. Ignoring ad-block-driven client loss. Not checking identity-merge logic. Forgetting ingestion delay on recent windows.

ONE CONCRETE EXAMPLE Analytics shows 12 percent fewer daily users than the database. Aligning timezones closes part of the gap, tracing one user reveals the tool merges anonymous and logged-in ids while the database counts only registered rows, and measuring ad-block loss explains the rest, so neither system was wrong, they just defined a user differently.

Interview question

Before concluding your analytics tool is broken because it shows fewer users than the database, what is the most important first step?

  • a.Rebuild the analytics ingestion pipeline from scratch
  • b.Verify both systems use the same user definition, time window, timezone, and filtersCorrect
  • c.Switch to server-side tracking for every event
  • d.Assume the database is correct and adjust the analytics numbers
Why?

Most discrepancies are definitional, so aligning the entity, window, timezone, and filters usually explains the gap. Rebuilding, switching tracking, or trusting one source blindly skips the actual root-cause investigation.

Just read this? Test yourself on what you have been reading.

Read the original → usermaven.com

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles