Sub topic 11
Analytics: automated insights and trend explanations
This chapter covers the analytics feature that turns a detected change into a written explanation. It assumes you know what a dashboard and a metric are, and that you have seen the anomaly detection chapter, where a z-score flags a value that departs from its baseline. Automated insights start where anomaly detection stops. Detection says that something changed. An insight says where, by how much, and what probably drove it.
What an automated insight is
An automated insight is a short, system-written finding about your data, such as "Signups rose 18% this week, mostly from paid search in Germany." Platforms usually surface insights as cards on a dashboard, as lines in a weekly digest, or as a "Why did this change?" button next to a chart.
Most insights are built from two stages:
- Analysis. Ordinary code and statistics find the facts: which metric moved, by how much, and which segments account for the movement.
- Narration. A template or a large language model (LLM) turns those facts into a sentence.
Keeping these stages apart matters. The numbers come from computation over your data. The LLM, when one is used, only phrases them. When a platform lets the LLM invent the numbers as well, the output can state things that are false.
Types of insight
Platforms group their insights into a few recurring kinds.
| Insight type | What it reports | Typical technique |
|---|---|---|
| Anomaly | A value outside its expected range | Z-score, or a forecast with a prediction interval |
| Trend | A sustained rise or fall | Linear fit or smoothing over a window |
| Driver | Which segments explain a change | Breakdown by dimension, contribution ranking |
| Comparison | Differences between periods or groups | Period-over-period change |
| Forecast | Expected future values | Time-series model, seasonal baseline |
Forecasting appears in the spine entry for this chapter, but it follows the same pattern as the others. The model produces a number and a range, and the narration reports both.
Finding the drivers
The most useful insight is the driver explanation. The usual method is a contribution breakdown. For a metric that is a sum, such as signups, you compare the two periods in every segment. Then you rank segments by how much of the total change each one accounts for.
The next example does this for signups by channel.
last_week = {"organic": 400, "paid_search": 300, "email": 200, "referral": 100}
this_week = {"organic": 410, "paid_search": 480, "email": 195, "referral": 105}
total_change = sum(this_week.values()) - sum(last_week.values())
contributions = {
channel: this_week[channel] - last_week[channel]
for channel in last_week
}
ranked = sorted(contributions.items(), key=lambda item: abs(item[1]), reverse=True)
print(f"Total change: {total_change:+d}")
for channel, change in ranked:
share = change / total_change
print(f"{channel}: {change:+d} ({share:.0%} of the total change)")The total change is +190. Paid search contributes +180, which is 95% of it. A narration layer can now write "Signups rose 19% week over week, driven almost entirely by paid search." Every figure in that sentence came from the code above, not from a language model's guess.
Ratio metrics are harder
Sums are easy because contributions add up. A rate such as conversion rate does not. If conversion rate falls from 4.0% to 3.5%, the cause might be a drop inside each segment, or a shift in traffic toward a segment that converts poorly. Good tools separate these two effects, often called the rate effect and the mix effect. Simple tools skip the separation and blame whichever segment has the lowest rate.
How the narration works
There are two common ways to write the sentence.
- Templates. A fixed pattern such as "{metric} {direction} {pct}% vs {period}, mainly from {segment}." This is predictable and cheap, but the wording is repetitive.
- LLM narration. The model receives the computed facts as input and writes a paragraph. The wording is natural and can adapt to context, but the model may add claims that the facts do not support.
A safe design passes the model a structured list of verified facts and instructs it to use only those. Some platforms also check the output by extracting every number from the generated text and confirming each one appears in the input facts.
Correlation, not cause
A driver explanation describes where the change happened. It does not establish why. "Paid search drove the increase" is a statement about attribution of the numbers. It does not say whether a new campaign, a competitor outage, or a tracking bug caused the paid search rise.
Platforms often blur this line with wording like "because" or "due to." Read these as "coincided with." To test a cause you need an experiment or a holdout group, which a later chapter covers.
Common failure modes
- Noise reported as signal. With many metrics and many segments, some will move by chance. If a tool checks 500 segment-metric pairs each week, a few will look striking at a 3-sigma threshold purely by luck. This is the multiple comparisons problem. Better tools raise the bar as the number of checks grows.
- Seasonality mistaken for a trend. Weekend dips, month-end spikes, and holidays are regular patterns. A tool that compares this Monday with last Sunday will report a spurious change. Good insights compare like with like, such as this Monday with last Monday, or use a seasonal baseline.
- Small-sample percentages. "Referral signups up 50%" can mean 2 to 3 signups. Good tools suppress insights below a minimum volume.
- Data quality problems presented as business changes. A broken tracking tag can look like a traffic collapse. The insight will faithfully explain a drop that never happened. Check pipeline health before acting on a surprising result.
- Simpson's paradox. An overall trend can point one way while every segment points the other, when the segment mix shifts. Contribution breakdowns need the rate and mix split to avoid this.
- Fluent but unsupported narration. An LLM may add a plausible cause, such as "likely due to the holiday promotion," that is not in the data.
A minimum-volume and seasonality guard
The following code adds two of the defenses above to a week-over-week comparison. It skips segments with too little volume and compares the same weekday across weeks.
def safe_change(current: int, previous: int, min_volume: int = 50):
"""Return percent change, or None if the volume is too small to trust."""
if previous < min_volume and current < min_volume:
return None
if previous == 0:
return None
return (current - previous) / previous * 100
segments = {
"paid_search": (480, 300),
"referral": (3, 2),
"email": (195, 200),
}
for name, (current, previous) in segments.items():
change = safe_change(current, previous)
if change is None:
print(f"{name}: too little data to report")
else:
print(f"{name}: {change:+.1f}% vs the same period last week")Referral is suppressed, so the digest does not announce a 50% rise built on three signups.
Deciding whether to trust an insight
Before acting on an automated insight, run through a short checklist:
- Source. Which metric, date range, and filters did it use? Insights computed on a filtered view can mislead.
- Size. How many underlying events are there? Check the raw counts.
- Baseline. Compared with what? A matching weekday and period is better than "yesterday."
- Data health. Did a tag, import, or integration change recently?
- Cause. Is the explanation a measured attribution or a guess?
- Action. Would a wrong insight be costly? If so, keep a person in the approval path, as the human-in-the-loop chapter describes.
Where this feeds next
Insights often become inputs to larger workflows. A digest might trigger a Slack message, or a detected driver might open a task for the paid search owner. Those chains are the subject of the agentic workflows chapter. The same caution applies there: a wrong insight that triggers an automatic action costs more than one that a person reads and ignores.
Exercise
Weekly signups rose from 1,000 to 1,200. Segment A rose from 100 to 270, segment B fell from 600 to 580, and segment C rose from 300 to 350. Which segment should the insight name as the main driver, and what share of the total change did it account for? Also give one reason you would still not write "because of segment A."
Show answer
Segment A is the main driver. Its change is +170, and the total change is +200, so it accounts for 85% of the increase. Segment B contributed -20 and segment C +50. Writing "because of segment A" would claim a cause. The breakdown only shows where the increase appeared. A campaign, a tracking change, or a one-off event in segment A could each explain it, and you would need to investigate or run a test to know which.
Exercise
An automated insight says "Conversion rate fell 12% this week, likely due to the new landing page." List two checks you would make before telling your team the landing page is at fault.
Show answer
First, check whether the traffic mix changed. A shift toward a segment with a lower conversion rate can lower the overall rate even if every segment is unchanged (the mix effect). Second, check data health and baseline, for example whether a tracking tag broke when the page launched, or whether last week was a seasonal high. A holdout or A/B test of the old and new page would be the direct way to test the landing page claim. The phrase "likely due to" is also a sign of unsupported narration, so confirm that the driver analysis actually produced it.