October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Mountain View desk5 min

Google Keyword Volume: A Python Checklist for Reviewing Peaks

A careful Python workflow for Google Ads monthly search-volume spikes: preserve targeting context, model trend and seasonality, and review before correcting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Google Ads monthly search-volume figures as estimates, not exact counts, and treat an unusual peak as a review flag—not automatic proof of bad data. A practical Python workflow preserves the original values, aligns the export’s targeting context, decomposes a sufficiently long monthly series with robust STL, then reviews flagged months before making any correction.

What Google keyword volume measures

This guide concerns historical search-volume metrics from Google Ads Keyword Planner, including API exports. It does not establish that third-party SEO tools use identical data or definitions. Google’s API describes monthly_search_volumes as approximate monthly values for up to four years; avg_monthly_searches is an average for the past 12 months or the requested year-month range. Google says it updates metrics such as search volume monthly using the preceding month’s search data. Google Ads API: Generate historical metrics.

As an Amazon Associate I earn from qualifying purchases.

The number is tied to its settings. Google Ads Help defines average monthly searches using the selected date range, location, Search Network, and keyword close variants. A US series and a UK series—or exports with different network settings—are not interchangeable measurements. Preserve these details before joining or comparing data. Google Ads Help: About Keyword Planner forecasts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Historical volume is also distinct from a forecast. Google says forecasts account for bid, budget, seasonality, and historical ad quality; historical search-volume statistics do not. Do not use forecast inputs to explain a peak in historical metrics. The API may deduplicate close variants and return them in close_variants, so retain the requested term, returned text, and any listed variants.

Prepare the data before looking for spikes

Keep an untouched copy of each export and attach its context to every observation. At minimum, preserve the source, extraction date, keyword and returned/normalized keyword, month, location, language, Search Network, and requested date range. Keep close variants and any currency or bid fields when they are included. Google’s API documentation describes how request targeting and close variants relate to the results; the official Python sample shows historical-metric requests with language and geographic targeting. Google Ads API Python sample: Generate Historical Metrics.

  • Align keyword identity, geography, language, network, and time range before concatenating series.
  • Normalize month labels to a monthly date index, sort chronologically, and check for duplicate keyword-month-context keys.
  • Inspect missing and non-numeric values. Treat a missing month as missing, not as zero: the reviewed Google documentation does not say that an omitted export row means no searches.
  • Plot the series. A single-month jump that quickly reverses differs from a higher level that persists.

Google recommends caching or storing keyword-planning results. Because historical metrics refresh monthly and responses may remain consistent for hours or days, keep consistent snapshots and extraction metadata so a refresh can be distinguished from a targeting change. Google Ads API: Keyword planning.

Use robust STL to separate seasonality from unusual residuals

For a regularly spaced monthly history long enough to estimate an annual cycle, STL can separate a series into trend, seasonal, and residual components. Statsmodels’ robust option reweights observations so the fit can tolerate some large errors. For monthly data, set the period to 12; pass it explicitly when the index does not carry frequency metadata. See the statsmodels STL documentation and examples.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import pandas as pd
from statsmodels.tsa.seasonal import STL

# df columns: keyword, month, searches, geo, language, network
series = (
    df.loc[df["keyword"].eq("example keyword")]
      .sort_values("month")
      .set_index("month")["searches"]
      .astype(float)
)
series.index = pd.to_datetime(series.index)
series = series.asfreq("MS")  # inspect gaps; do not assume a gap is zero

# Resolve or deliberately handle gaps before fitting.
if series.isna().any():
    raise ValueError("Resolve or explicitly handle missing months before STL")

fit = STL(series, period=12, robust=True).fit()
components = pd.DataFrame({
    "observed": series,
    "trend": fit.trend,
    "seasonal": fit.seasonal,
    "resid": fit.resid,
    "robust_weight": fit.weights,
})

This is a workflow illustration; adapt field names to the export and validate the data before using it. Do not interpolate across a suspected spike simply to make the model run. Statsmodels examples show forward-filling in one sample dataset, but that is not a universal rule for keyword volumes. Choose gap handling based on why observations are missing, document it, and consider excluding short or incomplete histories from STL. statsmodels STL documentation and examples.

Flag observations for review, not automatic deletion

A transparent screening heuristic is to flag residuals that are unusually large relative to the residual distribution, using a robust scale such as the median absolute deviation (MAD). This is a proposed analyst rule, not a Google or statsmodels threshold. Neither source prescribes a universal cutoff or replacement value. Choose and document a threshold for your dataset, and check how the flagged months change under other reasonable thresholds.

For each flagged month, compare it with the original export and the available demand context. Check whether the peak recurs in the same season in other years, whether related keywords rise at the same time, whether the increase persists, and whether collection or targeting settings changed. A repeatable seasonal peak or persistent step-up is reason to retain the movement as potential real demand. A lone, uncorroborated point deserves investigation, not an assumption that it is erroneous.

If source-level checks confirm an error, retain both versions and record the reason and provenance. For example, keep searches_raw, searches_clean, is_flagged, and correction_reason alongside the relevant extraction metadata. If you cannot verify the value, leave it unchanged and label it as a potential anomaly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose a screening method that fits the question

Method Trend and seasonality History and sensitivity Best use
Visual review and context checks Can account for both when interpreted against the series and its context. Does not require a formal model; less scalable. Essential review for any method’s flags and corrections.
Robust STL residual review Models trend and recurring seasonality separately. Needs enough regularly spaced history and deliberate gap handling; a flag is not proof of error. Monthly series with enough history to estimate an annual cycle.
Global z-score or fixed cap Does not inherently account for seasonal peaks or trend changes. Easy to implement, but may mislabel genuine peaks or new levels. Not a good default for cleaning seasonal keyword data.
Rolling median/MAD screening Can highlight local deviations, but does not automatically understand annual seasonality. Window and threshold are judgment calls and require validation. Lightweight local anomaly flags when the window is appropriate to the series.

Whichever screen you use, describe the output as a reviewed or adjusted analytical series, not “the true search volume.” Google’s figures are approximate and context-sensitive, and an anomaly detector only identifies observations that differ from its model.

Read API data reproducibly

If you retrieve metrics directly, build on Google’s current Python historical-metrics sample and verify which API version your client uses. Store targeting and extraction details with each snapshot; changing locale or network settings can produce a different measurement context even when the keyword text is unchanged.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.