---
title: "Fail CI builds on analytics tracking gaps the way you fail them on test coverage"
description: "Treat the tracking plan as a machine-readable contract and check it on every pull request: presence, property shape and regressions. Where the gate belongs, what it catches and how to roll it out without blocking every merge."
url: https://www.skene.ai/resources/blog/failing-ci-builds-for-analytics-instrumentation-gaps-the-way-you-already-fail-them-for-test-coverage
doc_version: "9b579fc2bed4"
last_updated: 2026-11-23
---

# Fail CI builds on analytics tracking gaps the way you fail them on test coverage

CI should check analytics tracking the way it checks test coverage. A missing event lets a release pass while leaving a growth experiment without the data it needs. The fix is to make the tracking plan a machine-readable contract and check it before merge, while a broken tracking call can still be corrected in code and before it leaves a hole in the record.

## Tracking failures make no noise, test failures do

A growth team launches an experiment, waits for results and opens the funnel report. The events were never recorded, or their names changed halfway through. The product worked and the build was green, yet the team cannot tell whether the experiment failed or its measurement did. By the time anyone asks, the chance to record those interactions has passed.

A failing test stops the merge. A tracking call that stops firing passes. Onkar Khadke's 2026 paper on [data integrity in CI/CD pipelines](https://journals.eanso.org/index.php/eajit/article/view/5949) describes code-level test automation as well established while data-integrity checks are still mostly manual, ad hoc or run separately. Manual review can judge whether a change makes sense. It does not compare every event with an agreed contract.

## A tracking plan is a contract a spreadsheet cannot enforce

A tracking plan lists which events exist, how they are named, which properties belong to them, and what makes a payload valid. A spreadsheet can communicate that agreement well, and a reviewer can use it to discuss what an experiment needs. It cannot stop a merge when a required property disappears.

Putting the plan in Git versions it with the implementation, but something still has to read the plan to enforce it. Mixpanel reports depend on stable property keys, and PostHog uses the same event stream for analytics, feature flags and experiments, so drift can break cohorts and experiment targeting as well as a chart label. The plan needs a machine-readable form and an automatic comparison with the code before it works as a gate.

## What coverage gates already teach us

The team declares a threshold, CI reads the coverage report, and a result below the threshold fails the build. Nobody has to remember to object. The mechanism has three parts: a machine-readable definition of passing, an automatic check on every pull request, and a result that blocks when the definition is broken. A warning on its own is information, not a gate.

Schema contracts can use the same machinery. Khadke's framework gates each pipeline stage on schema contracts that check field definitions and value domains before promotion. Across 14 contracts it reports a 99.1% contract pass rate and 47% fewer data-integrity incidents after release. For analytics, the contract is the tracking plan, and what gets checked is the tracking code in the proposed change.

## What the gate checks

The **presence check** asks whether the events the tracking plan declares are implemented in the code being merged. For a change that introduces tracking, it looks for the required calls in the diff, and an absent call fails the build. It catches the case ordinary tests miss: the feature works and nothing records its use.

The **property-shape check** asks whether each payload matches its declared schema. A matching event name is not enough. If the contract requires `user_id`, a missing value or a renamed key is a violation.

The **regression check** compares tracking before and after the pull request and catches events renamed, removed or restructured without a matching plan update. Together the three checks separate missing work, malformed payloads and damage to tracking that already worked. [Make analytics event review a required gate in your merge checklist](https://www.skene.ai/resources/blog/make-analytics-event-review-a-required-gate-in-your-merge-checklist) covers the human side of the same checks: firing conditions, duplication and who approves.

## Put the gate before merge

The schema check belongs in the pull request suite, before merge, where a regression can still be rejected before it reaches users. Post-deploy checks still help, and they find production problems a code check cannot see. But finding a gap after release does not prevent it. An empty funnel report cannot supply the events that should have filled it.

The latency objection deserves an answer. Data CI checks that run a pipeline can take tens of minutes, a real addition to the path from change to release. A gate that statically compares code with a tracking plan does not run a pipeline, so it fits in the standard pull request checks. Khadke's framework places its checks at the same point, before promotion. Once an interaction goes unrecorded, no later patch brings it back.

## Coding agents add a faster source of regressions

An agent can rename a function, move a file or refactor a component and change or delete a tracking call along the way. People make the same mistake. Agents make changes faster, with no guarantee they know the tracking plan exists, and the more code moves through review, the weaker a convention people have to remember becomes.

Agents are now major participants in analytics itself. PostHog [reported](https://posthog.com/blog/how-ai-agents-behave) that agents using its MCP server created about 2.5 times as many insights in a 30-day window as people did in the web app. Their activity needs a contract too. A property such as `interaction_source`, with the values `human` and `agent`, keeps both kinds of activity distinguishable in one stream, but without enforcement it becomes one more optional convention.

Agents also write tracking. Amplitude's MCP plugin includes an `add-analytics-instrumentation` skill that reads a codebase and produces a tracking plan. A generated plan still has to be compared with the declared schema, and generated code with the plan. The pull request gate does that without asking reviewers to keep up with the agent's typing speed.

## How Skene checks pull requests

With pull-request reviews on, the Skene GitHub App reads every pull request on the linked repository and flags renamed or removed tracking before merge. A problem gets a **request changes** review with comments on the exact lines, and a clean pull request gets a pass. A one-line fix comes as a GitHub suggestion, and anything larger as a prompt you can paste into a coding agent. Once a later run passes, Skene dismisses its earlier change request, so a fixed branch is not left blocked. It is one implementation of checking the contract at the boundary.

For the plan side, you describe the experiment and its target in Skene's [measurement plans](https://www.skene.ai/product/measurement), Skene drafts the events it needs, and checks your code for each one. Missing events are listed and written into a brief for a coding agent, which connects what growth needs to measure with what engineering needs to add.

The data comes from separate places. GitHub supplies the code and the pull requests, PostHog or Mixpanel the events actually received, and Supabase the schema. Skene keeps them apart, because finding a tracking call in code and finding the event in your analytics tool are different facts. After launch, it compares the result with the target your team set, and treats a measured change as evidence rather than proof the release caused it. It sits in front of your analytics and warehouse tools rather than replacing them.

## Where other tools fit

Great Expectations runs data-validation checks inside CI/CD, against staging or fixture data, and can catch regressions before events reach production. Soda Core validates at the data layer in the same way. Both inspect the data, so adding them to a pull request workflow means wiring data checks into it rather than comparing tracking calls with a plan.

Monte Carlo and Metaplane focus on production observability and anomaly detection. They answer whether production data has changed unexpectedly, a question that remains after a schema check passes, because code that matches the plan does not guarantee production behaves. They do not replace the pre-merge check for a deleted tracking call, and the pre-merge check does not replace them.

PostHog's MCP analytics SDK takes another approach, sending a stable, typed schema for MCP tool calls, though its scope is limited to that tooling. Together these tools cover different points: building the event, validating the data and watching production.

## Roll the gate out without blocking every pull request on day one

Start with visibility. Run the tracking check in CI in report-only mode, so every pull request shows which events would have failed without blocking the build. The team sees its real gaps and learns what the check finds before it becomes policy. A gate earns trust more easily when people have already seen what it catches.

Next, block merges for a chosen set of events, usually the ones behind active experiments, and only warn on the rest. Then extend enforcement to the whole plan. At that stage a pull request that renames, removes or fails to implement a declared event fails the build unless the contract changes with it. Name one owner for the plan and route new events through a short review, so changes stay deliberate without every event becoming a committee decision.

Threshold-based data checks need care during rollout, because small samples produce noisy alerts. A percentage threshold paired with a minimum count of affected events filters most of that noise. The final test is the experiment retrospective, where the target and the result can be compared using the events the team meant to collect. [Analytics tracking coverage in pull requests](https://www.skene.ai/resources/blog/analytics-tracking-coverage-in-pull-requests) explains why code coverage alone cannot stand in for that check.

## Sitemap

- [Markdown sitemap](https://www.skene.ai/sitemap.md): every page on this site, with its markdown counterpart.
- [Index for language models](https://www.skene.ai/llms.txt): the same set as a link-dense index.
- [Full corpus](https://www.skene.ai/llms-full.txt): reference content concatenated as plain text.
