Sub topic 12
Annotating Changes So Trends Can Be Explained Later
A trend line shows that clicks changed. It does not show why. Six months later, nobody remembers that the navigation was redesigned on 12 March or that a canonical tag broke on 3 April. This chapter covers how to record those events as data, so that a drop or jump can be explained from evidence instead of memory.
This chapter assumes you have read the earlier chapters on the daily data model and trend analysis. You should have a gsc_daily table, know what a rolling average is, and be able to read basic pandas and SQL.
Why annotations are part of the dataset
Search metrics are observational. You cannot rerun last quarter with the site migration removed. The only way to link a change in the numbers to a cause is to have a dated record of what happened around that time.
Annotations are often written after the fact, from guesses, or kept in someone's head. Each of these fails in a predictable way:
- Memory fades. The person who shipped the change leaves, or simply forgets the date.
- Late annotations are biased. If you annotate only after seeing a drop, you tend to record events that fit the story and skip the ones that don't.
- Notes outside the data are not queried. A chat message cannot be joined to a table. A row in an
annotationstable can.
What to record
Four kinds of event matter for search tracking. Each has a different source and a different reliability.
| Category | Examples | Where the date comes from |
|---|---|---|
| Site change | Template redesign, URL migration, title rewrite, robots.txt edit, internal link restructure | Deployment log, release notes, version control |
| Content change | New page group published, pages pruned, bulk meta description update | CMS publish history |
| Search event | Core update, spam update, new SERP feature rollout | Google's Search Status Dashboard and industry reports |
| Data event | Tracking tag removed, Search Console property change, API pipeline outage, rank tracker settings change | Your own pipeline logs and tool changelogs |
Data events are the category most often forgotten. A pipeline that silently skipped three days produces a dip that looks like a ranking loss. Record these with the same care as site changes.
Designing the annotation table
Keep the table small and give it a fixed grain: one row per event.
annotation_id: a unique key.date: the date the change took effect in production, not the date you noticed it.end_date: optional, for events with a duration such as a rollout or outage. Leave it empty for a single day.scope: what the change touched. Use values such assite, a page group name likeblog, or a URL path prefix. This lets you ask whether the change could plausibly affect the segment you are examining.category: one of the four categories above, as a controlled list.description: one plain sentence saying what changed.source: a link or reference such as a pull request, ticket, or announcement.
The scope field does the most work in diagnosis. A title rewrite on /blog/ cannot explain a drop in /pricing/, and with scope recorded you can exclude it automatically.
Recording events at the moment they happen
The most reliable annotations are written when the change ships. Three habits make that realistic:
- Add a step to the release checklist. One line: "Add an annotation if this release can affect crawling, rendering, titles, links, or URLs."
- Automate what you can. If deployments run through CI, a job can append a row for every release that touches templates or routing. The
sourcefield then holds the commit or pull request link. - Log your own pipeline failures. When the collection job fails or backfills, write a data event in the same handler that raises the alert.
A tolerable minimum is a CSV file in version control. It has a history, it can be reviewed, and pandas reads it directly.
Overlaying annotations on a trend
The example below builds synthetic daily clicks and a few annotations, then draws the 7-day rolling mean with a labeled marker for each event. Replace the synthetic series with your own daily clicks.
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
# Synthetic daily clicks with a drop starting on 2026-03-12
rng = np.random.default_rng(7)
dates = pd.date_range("2026-02-01", "2026-04-30", freq="D")
base = np.where(dates < "2026-03-12", 1000, 780)
clicks = pd.Series(rng.poisson(base), index=dates, name="clicks")
annotations = pd.DataFrame(
{
"date": pd.to_datetime(["2026-02-20", "2026-03-12", "2026-04-03"]),
"scope": ["blog", "site", "site"],
"category": ["content", "site_change", "search_event"],
"description": [
"Published 40 new guides",
"Navigation redesign released",
"Core update began rolling out",
],
}
)
trend = clicks.rolling(7).mean()
fig, ax = plt.subplots(figsize=(10, 4))
ax.plot(clicks.index, clicks, alpha=0.3, label="Daily clicks")
ax.plot(trend.index, trend, label="7-day mean")
for i, row in annotations.iterrows():
ax.axvline(row["date"], color="grey", linestyle="--", linewidth=1)
ax.text(
row["date"], ax.get_ylim()[1], f" {i + 1}",
va="top", ha="left", fontsize=9,
)
ax.set_ylabel("Clicks")
ax.legend(loc="lower left")
fig.tight_layout()
fig.savefig("clicks_with_annotations.png", dpi=120)
for i, row in annotations.iterrows():
print(f"{i + 1}. {row['date'].date()} [{row['category']}] {row['description']}")Numbering the markers and printing a legend keeps the chart readable when many events cluster together. Long labels printed on the plot overlap quickly.
Querying annotations during diagnosis
Once annotations are in the database, a drop can be listed together with the events that preceded it. The query below finds weeks where clicks fell more than 15% against the prior week. It then attaches any annotation from the 14 days before the week through its end. The 14-day lookback allows for the delay between a change and its effect on rankings.
-- PostgreSQL syntax
-- gsc_daily(date, query, page, clicks, impressions, position)
-- annotations(annotation_id, date, end_date, scope, category, description, source)
WITH weekly AS (
SELECT
DATE_TRUNC('week', date)::date AS week,
SUM(clicks) AS clicks
FROM gsc_daily
GROUP BY 1
),
changes AS (
SELECT
week,
clicks,
LAG(clicks) OVER (ORDER BY week) AS prev_clicks
FROM weekly
)
SELECT
c.week,
c.prev_clicks,
c.clicks,
a.date AS annotation_date,
a.category,
a.scope,
a.description
FROM changes c
LEFT JOIN annotations a
ON a.date >= c.week - 14
AND a.date < c.week + 7
WHERE c.prev_clicks > 0
AND c.clicks < 0.85 * c.prev_clicks
ORDER BY c.week, a.date;The LEFT JOIN matters. A drop with no matching annotation still appears, with empty annotation columns. That is useful information: either an unrecorded change, an external cause, or noise.
Reading annotations without overreading them
An annotation next to a change is a candidate explanation, not proof. Several limits apply.
- Timing is fuzzy. Search engines recrawl and reprocess pages over days or weeks. A change on one day may show up gradually.
- Events overlap. If a redesign, a core update and a tracking fix all land in one fortnight, the data alone cannot separate them. Where possible, stagger releases, or ship changes to a subset of pages first so that unchanged pages act as a control.
- Scope should match. Check whether the affected segment (from the segmentation chapter) is the one the event touched. A site-wide event should move many segments. A single-section event should move that section.
- Absence is also evidence. If a core update has no visible effect on any of your segments, record that too, as a note on the annotation.
Common mistakes
- Annotating the decision date instead of the release date. The ticket approved on Monday shipped on Thursday. Use Thursday.
- Free-text categories. "redesign", "Redesign" and "site redesign" cannot be grouped. Use a fixed list.
- No scope. Without it, every event looks like a possible cause of every change.
- Time zones. Search Console dates follow a fixed reporting time zone. Your deployment log may use local time. Convert both to one zone before joining, or a late evening release lands on the wrong day.
- Too many trivial entries. Logging every typo fix hides important events. Record anything that could change crawling, rendering, indexable content, titles, headings, internal links, or URLs.
Exercise
A weekly report shows clicks to your /pricing/ pages fell 20% in the week of 9 June. Your annotations table has three rows within the prior 14 days: a blog template change (scope: blog, 2 June), a core update announcement (scope: site, 4 June) and a pipeline outage that skipped 5 and 6 June (category: data event, scope: site). Which annotation would you check first, and how would you decide whether the drop is real?
Show answer
Check the pipeline outage first. Missing days of data would lower weekly clicks regardless of real search behavior, so confirm that all seven days of the week are present and re-run the pull if not. If the data is complete, the blog template change is out of scope for /pricing/, so set it aside. The core update is then the remaining plausible candidate. Verify it by comparing /pricing/ with other segments over the same period, and check whether queries lost impressions or only clicks. Treat the update as a hypothesis, not a confirmed cause.
Exercise
Why does the annotations table store the production date of a change rather than the date it was logged, and what field would you add if a change rolled out gradually over ten days?
Show answer
The production date is when the change could first affect crawling and rankings, so it is the date that must line up with the trend. Logging dates would shift events later and break the comparison. For a gradual rollout, add an end_date field so the event covers a range, and join on dates that fall within that range.