DEV Community

TalorData
TalorData

Posted on

How to Compare Two SERP Snapshots and Detect Ranking Changes

If you are building a keyword rank tracker, collecting SERP data is only the first step.

The useful part is detecting what changed between two search result snapshots.

For example:

  • Did a page move from position 8 to position 3?
  • Did a competitor enter the top 10?
  • Did a URL disappear from page one?
  • Did the same domain rank with a different page?

What to store in a snapshot

A SERP snapshot should include both the results and the search context.

{
  "query": "search api",
  "engine": "google",
  "device": "desktop",
  "country": "us",
  "checked_at": "2026-05-18T08:00:00Z",
  "results": [
    {
      "position": 1,
      "title": "Example result",
      "url": "https://example.com/page",
      "domain": "example.com"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Do not compare two snapshots unless the context matches:

query
engine
device
country or location
Enter fullscreen mode Exit fullscreen mode

Otherwise, the ranking change may be caused by a different search context, not by SEO movement.

Compare by URL and domain

You usually need two views.

URL-level comparison answers:

Did this exact page move?
Enter fullscreen mode Exit fullscreen mode

Domain-level comparison answers:

Is this website still visible, even if a different page ranks?
Enter fullscreen mode Exit fullscreen mode

Example:

Yesterday: example.com/old-page at position 5
Today: example.com/new-page at position 6
Enter fullscreen mode Exit fullscreen mode

At URL level:

old-page dropped
new-page is new
Enter fullscreen mode Exit fullscreen mode

At domain level:

example.com moved from 5 to 6
Enter fullscreen mode Exit fullscreen mode

Both are useful.

Basic change types

For each URL or domain, classify the change as:

new
dropped
moved_up
moved_down
unchanged
Enter fullscreen mode Exit fullscreen mode

Use this delta formula:

delta = previous_position - current_position
Enter fullscreen mode Exit fullscreen mode

So:

8 -> 3 = +5
3 -> 8 = -5
Enter fullscreen mode Exit fullscreen mode

Positive means the result improved.

Example change report

{
  "query": "search api",
  "engine": "google",
  "device": "desktop",
  "country": "us",
  "changes": [
    {
      "type": "moved_up",
      "url": "https://example.com/page",
      "domain": "example.com",
      "previous_position": 8,
      "current_position": 3,
      "delta": 5
    },
    {
      "type": "new",
      "url": "https://competitor.com/page",
      "domain": "competitor.com",
      "previous_position": null,
      "current_position": 7,
      "delta": null
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Store snapshots, not only diffs

Do not store only the ranking changes.

Store the full snapshots first, then calculate diffs from them.

That makes it easier to:

reprocess old data
fix comparison bugs
change URL normalization rules
audit strange ranking changes
generate new reports later
Enter fullscreen mode Exit fullscreen mode

A simple data model is:

serp_snapshots
serp_results
serp_changes
Enter fullscreen mode Exit fullscreen mode

The serp_changes table can always be regenerated.

Common mistakes

The most common mistakes are:

comparing different devices
comparing different countries
not normalizing URLs
tracking only one domain
mixing URL-level and domain-level changes
using confusing delta direction
storing only diffs
Enter fullscreen mode Exit fullscreen mode

Takeaway

A reliable SERP change detector needs more than yesterday’s position minus today’s position.

You need consistent search context, URL normalization, URL-level comparison, domain-level comparison, and full snapshot storage.

Once those are in place, ranking changes become much easier to explain.


Enter fullscreen mode Exit fullscreen mode

Top comments (0)