From Invisible to #1 on Google Maps. · 14 years experience · Book your free audit claim yours →
Technical SEO

Automating Structured Data Testing and Monitoring

Manual schema checks miss the regressions that cost you rich results. Here is how to validate in CI, crawl on a schedule, and alert on drift.

For: Technical SEOs, developers, and agencies maintaining schema across local business sites

The example.txt example from this guideA code editor showing the first lines of the example.txt example used in the guide.example.txt1# .github/workflows/schema-checks.yml2name: schema-checks3on:4pull_request:5paths: ['templates/**', 'src/**', 'conten…6jobs:7validate-schema:8runs-on: ubuntu-latest9steps:10- uses: actions/checkout@v411- uses: actions/setup-node@v412with: { node-version: 20 }3 layersSyntax, vocabulary, andpolicy checks1 gateA failing check blocks themergeDailySample crawl of keytemplates
3 layersSyntax, vocabulary, and policy checks
1 gateA failing check blocks the merge
DailySample crawl of key templates
WeeklyFull-site crawl and snapshot diff

Structured data rarely fails loudly. A developer renames a template variable, a plugin update strips a field, a CMS editor changes a price without touching the JSON-LD, and nothing breaks on screen. Rich results quietly disappear weeks later, and by the time anyone notices, the cause is buried under a dozen deployments.

Spot-checking a page in a validator is fine for a single launch. It does not protect a site that changes every week. This guide covers how to turn schema testing into an automated system: tests that run on every pull request, scheduled crawls that catch drift, checks that compare markup against visible content, and alerts that point a person at the exact URL and field that broke.

Best use case: The Rich Results Test and Schema Markup Validator are manual diagnostic tools, so build automation on your own rules, crawls, and the Search Console URL Inspection API.

Why manual schema checks stop scaling

A manual check answers one question: was this page valid at the moment someone tested it? Structured data is generated by templates, plugins, and CMS fields, so validity depends on code and content that keep changing after the check. Four failure patterns show up again and again:

  • Template regressions. A refactor changes how a variable renders and a required property such as address or offers becomes empty on every page that uses the template.
  • Silent plugin or theme updates. An SEO plugin changes its output format, removes a node from the @graph, or starts emitting a duplicate Organization block.
  • Content and markup drift. Editors update the visible phone number, hours, or price, but the JSON-LD is hard-coded or cached and keeps the old value.
  • Rendering changes. Markup injected by JavaScript or a tag manager stops firing after a consent-banner or script change, so the raw HTML and the rendered DOM no longer agree.

None of these produce a visible error. They surface later as lost rich result eligibility or Search Console warnings. The fix is the one engineering teams use for everything else: automated tests, plus monitoring of production.

For a local business the stakes are practical. Your LocalBusiness markup carries your name, address, phone number, and hours. A wrong phone number in structured data is a citation inconsistency you created yourself.

Define what a passing test means

Before automating anything, define what a passing test means. "Valid" is not one thing, and a single validator rarely covers all of it. Split your checks into three layers:

  1. Syntax. Does every application/ld+json block parse as JSON, with correct quoting, no trailing commas, and a proper @context? A parse failure means the whole block is ignored.
  2. Vocabulary. Are the types and properties real schema.org terms, used on types that accept them, with values of the expected kind (a URL where a URL is expected, an ISO 8601 date, a number rather than a string with a currency symbol)? The Schema Markup Validator at validator.schema.org checks this generically.
  3. Policy. Does the markup meet the requirements for the features you want, and your own standards? Google documents required and recommended properties for each rich result type. Your policy layer encodes those, plus site-specific rules such as "every location page must include telephone, geo, and openingHoursSpecification."

The policy layer is where most of the value sits, and generic tools cannot do it for you. Google's required properties are a minimum for eligibility; your own rules should be stricter. Keep them in a small rules file in the repository so changes get reviewed like code.

Test templates rather than every page: one service page, one location page, one blog post, one offer page. That catches most regressions cheaply. Full-site coverage belongs to the scheduled crawl.

Validating schema in CI/CD

The cheapest place to catch broken schema is before it ships. A CI check builds the site, extracts every JSON-LD block from a sample of output pages, and fails the pull request on a violation. Keep it under a minute so nobody is tempted to skip it.

This conceptual example uses GitHub Actions and a small Node script; the structure carries over to any runner.

# .github/workflows/schema-checks.yml
name: schema-checks
on:
  pull_request:
    paths: ['templates/**', 'src/**', 'content/**', 'schema-rules.json']

jobs:
  validate-schema:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20 }
      - run: npm ci
      - run: npm run build
      - name: Validate JSON-LD against rules
        run: node scripts/check-schema.mjs --dir dist --sample sample-urls.txt
      - uses: actions/upload-artifact@v4
        if: failure()
        with: { name: schema-report, path: schema-report.json }

The script records every violation rather than stopping at the first, so a developer sees the full picture in one run:

// scripts/check-schema.mjs (conceptual)
import { readFileSync, writeFileSync } from 'node:fs';
import * as cheerio from 'cheerio';
import Ajv from 'ajv';

const rules = JSON.parse(readFileSync('schema-rules.json', 'utf8'));
const ajv = new Ajv({ allErrors: true, strict: false });
const failures = [];

for (const file of samplePages()) {
  const $ = cheerio.load(readFileSync(file, 'utf8'));
  const visibleText = $('main').text();

  $('script[type="application/ld+json"]').each((_, el) => {
    let data;
    try { data = JSON.parse($(el).text()); }
    catch (e) { return failures.push({ file, issue: 'invalid JSON', detail: e.message }); }

    const nodes = Array.isArray(data) ? data : (data['@graph'] || [data]);
    for (const node of nodes) {
      const rule = rules[node['@type']];
      if (rule && !ajv.validate(rule, node)) {
        failures.push({ file, type: node['@type'], issue: 'rule violation', detail: ajv.errors });
      }
      // parity check: schema value must appear on the page
      if (node.telephone && !digitsOnly(visibleText).includes(digitsOnly(node.telephone))) {
        failures.push({ file, type: node['@type'], issue: 'telephone not visible on page' });
      }
    }
  });
}

if (failures.length) {
  writeFileSync('schema-report.json', JSON.stringify(failures, null, 2));
  console.error(failures.length + ' schema problem(s) found');
  process.exit(1);
}

The rules file holds JSON Schema definitions per type. A LocalBusiness rule might require name, address, telephone, url, and openingHoursSpecification, and reject empty strings. If your site is built in TypeScript, typed libraries such as schema-dts add an earlier layer, turning an invalid property into a compile error.

What you can and cannot automate with Google's tools

Plans often stall on the "Rich Results Test API." Google's Rich Results Test and the Schema Markup Validator are web tools built for people. As far as Google documents, neither offers a supported public API for bulk testing, and scripting a headless browser against them is fragile. Check current documentation before designing around either.

What you can automate with supported tooling:

  • Your own validation in CI, as above, using the schema.org vocabulary and Google's documented property requirements as the source for your rules.
  • The Search Console URL Inspection API, which reports for an indexed URL whether Google detected rich result items and whether they carry errors or warnings. It works only for URLs in a property you own, and it reflects what Google last crawled, not what you just deployed. It also has daily quota limits, so use it on a sample rather than the whole site.
  • Search Console enhancement reports, which aggregate valid, warning, and error counts per rich result type, with email notifications when new issues appear.
  • Crawler-based validation. Desktop and cloud crawlers can extract structured data from every URL and validate it against schema.org and Google feature requirements on a schedule.

These are complementary. CI tells you what is about to ship, the URL Inspection API what Google processed, and a crawl what is live now. A mismatch between them is a signal, such as markup that passes CI but never appears in Google's report because it is injected after rendering.

Keep the Rich Results Test for debugging how a single URL renders, including JavaScript output. It is a diagnostic step, not a monitoring system.

Scheduled crawls that catch drift

CI protects you from your own deployments. It cannot catch changes that happen outside the repository: a plugin auto-update, a CMS field edit, a CDN rule, a third-party script. A scheduled crawl closes that gap by checking production on a fixed cadence.

A practical setup:

  1. Crawl a defined sample daily and the full site weekly. The daily sample is one URL per template plus your highest-revenue pages. The weekly crawl covers everything in the sitemap.
  2. Render JavaScript when your markup depends on it. Compare raw HTML extraction with rendered extraction. If a block appears only after rendering, note it, because that is a dependency on script execution that deserves a deliberate decision.
  3. Store the extracted JSON-LD, not just pass/fail. Save each page's blocks as normalized JSON, with keys sorted and whitespace removed, in a dated snapshot.
  4. Diff against the previous snapshot. A page whose @type changed, whose block count went from two to one, or whose aggregateRating vanished is flagged even when the remaining markup is technically valid.

The diff is what makes this monitoring rather than auditing. Validity checks find broken markup; diffs find changed markup, including valid but unintended changes such as a duplicate Organization node after a theme update.

Track a few counters per template: share of pages with a valid block, average blocks per page, and pages missing each required property. A step change points to a single cause that is far easier to find on the day it happens. Most crawlers can be scheduled and export CSV or JSON, enough to feed a short snapshot-and-diff script.

Catching schema-versus-content mismatches

Valid markup can still be wrong. Google's guidelines say structured data should describe content visible to users, and markup that contradicts it risks being ignored or treated as a policy violation. A syntax-only test will approve a page that advertises a price the page does not show.

Build a parity check that compares schema values with the rendered page. The most useful comparisons for a local business site:

  • Phone number and address. Normalize both sides (strip punctuation, standardize abbreviations) and confirm the schema values appear in the visible header, footer, or contact block.
  • Business hours. Compare openingHoursSpecification with the hours displayed on the page. Hours are the field most likely to drift when owners update a holiday schedule in one place only.
  • Price and availability. For offers, check that price and priceCurrency match the visible price, and that an "in stock" or "available" value matches what the page shows.
  • Ratings and review counts. If a page marks up aggregateRating, confirm the rating and count are displayed, and that the reviews are about the business or item on that page. Self-serving review markup on pages where reviews are not shown is a common source of manual actions.
  • Headline and dates. For articles, compare headline with the visible H1 and dateModified with the displayed update date.
  • FAQ content. Every question and answer in FAQPage markup should appear on the page in the same form.

Treat these as two severity tiers. A missing recommended property is a warning. A schema value that contradicts visible content is a failure, because it can mean the data is stale, hard-coded, or served from a cache that is out of sync with the CMS.

Cross-page consistency matters too. Your Organization block, location page markup, and Google Business Profile should agree. A weekly job that compares extracted values with a source-of-truth file keeps your own data aligned. Our schema generator can produce a clean baseline to compare against.

Alerting that people act on

Monitoring helps only if output reaches someone who can act on it. The most common failure is alert fatigue: a noisy channel everyone mutes within a month.

Design alerts around these principles:

  • Severity tiers with different routes. Blocking failures (invalid JSON, a required property missing across a template, schema-versus-content contradictions) page an owner or post to a monitored channel. Warnings go to a weekly digest.
  • Aggregate by cause, not by URL. If 400 location pages lost telephone, send one alert that names the template and the count, with a few example URLs, rather than 400 messages.
  • Include the evidence. Every alert states the URL, the type, the field, the old value, the new value, and the date of the last passing snapshot. A person should be able to open a ticket from the message alone.
  • Use thresholds for slow drift. Alert when the share of valid pages for a template drops by a set margin from its trailing average, not only on hard failures.
  • Close the loop. Each alert maps to an owner, and resolved alerts are confirmed by the next scheduled run rather than by someone saying it is fixed.

Delivery can be simple: a chat webhook, a tracker issue, or an email. Pair it with Search Console's own notifications as an independent signal; if Google reports a new error and your monitoring did not, you have found a blind spot. Allow documented exceptions in the rules file with a reason and an expiry date, so suppressions do not become permanent silence.

A monitoring workflow you can run this quarter

Here is a complete workflow assembled from the pieces above, sized for a small team or an agency managing several local business sites.

  1. Inventory your templates. List each page type and the schema types it emits. Pick one or two representative URLs for each. This becomes sample-urls.txt.
  2. Write the rules file. Start with Google's documented requirements for the features you target, then add your own completeness standards. Commit it to the repository.
  3. Add the CI gate. Run the check on pull requests that touch templates, content, or the rules file. Make it a required status check so it blocks merges.
  4. Schedule the daily sample and weekly full crawl. Store normalized JSON-LD snapshots and run the diff.
  5. Add parity checks. Compare phone, address, hours, price, ratings, and FAQ text with visible content. Fail on contradictions.
  6. Wire the alerts. Blocking issues to an owner, warnings to a weekly digest, each with evidence.
  7. Cross-check with Google. Review Search Console enhancement reports weekly and spot-check sampled URLs with the URL Inspection API. Investigate any case where Google disagrees with your own results.
  8. Review quarterly. Update the rules when Google changes feature requirements or retires a rich result type, and remove checks for features you no longer target.

A free site audit is a reasonable starting baseline before you build any of this: run a website SEO audit to see which templates already emit markup and which have none, then prioritize the rules for the templates that drive calls and bookings.

Keep expectations realistic: valid structured data does not guarantee a rich result. What automation gives you is narrower but valuable. You will know within a day when markup you depend on breaks, and why.

FAQ

Is there an official Rich Results Test API?

Google does not document a public API for the Rich Results Test or the Schema Markup Validator, so check current documentation before relying on one. For supported automation, write your own validation in CI, use the Search Console URL Inspection API for indexed pages, and run scheduled crawls that extract and validate JSON-LD.

How often should structured data be monitored?

Run CI checks on every pull request that touches templates or content. Crawl a small sample of key templates daily and the full site weekly. Review Search Console enhancement reports weekly. Daily sampling catches plugin updates and content edits quickly, while weekly full crawls catch slower drift across long-tail pages.

What is a schema-versus-content mismatch?

It is markup that contradicts what visitors can see on the page, such as a JSON-LD phone number, price, or set of hours that differs from the visible text. Google's guidelines expect structured data to reflect visible content, so mismatches should fail tests rather than merely warn, because they often signal stale or hard-coded values.

Should schema warnings fail a CI build?

Fail the build on syntax errors, missing required properties, and contradictions with visible content. Report missing recommended properties as warnings instead, since blocking on them creates noise and delays unrelated work. Promote a warning to a failure only when you decide the property is mandatory for your own standards.

Do I need to test every page, or only templates?

Test representative pages per template in CI, because markup comes from templates and one sample reveals most regressions quickly. Use scheduled crawls for full coverage, since individual pages can break through content edits, missing fields, or conditional logic that a single sample page does not exercise.

Turn this into a practical SEO action plan

Use RankLocalToday tools to check rankings, diagnose website issues, and prioritize the next organic traffic move.

Get your SEO plan →