DEV Community

Tugelbay Konabayev
Tugelbay Konabayev

Posted on • Originally published at about-kazakhstan.com

Building a Real-Time Position Tracker for Google Rankings

The Problem

SEO tools like Ahrefs and SEMrush charge $100+/month for rank tracking. For a small site with 90 pages, that is overkill. Google Search Console provides position data for free, but has no built-in way to track changes over time.

The Solution

A Node.js script that snapshots daily positions from GSC API and computes deltas against the previous snapshot.

Architecture

GSC API (28-day data) -> Parse pages + positions -> Save snapshot JSON -> Compare with previous -> Output delta report
Enter fullscreen mode Exit fullscreen mode

Fetching Position Data

import { google } from "googleapis";

const webmasters = google.searchconsole("v1");

async function getPositions(siteUrl, days = 28) {
  const endDate = new Date().toISOString().slice(0, 10);
  const startDate = new Date(Date.now() - days * 86400000)
    .toISOString().slice(0, 10);

  const res = await webmasters.searchanalytics.query({
    siteUrl,
    requestBody: {
      startDate, endDate,
      dimensions: ["page"],
      rowLimit: 1000
    }
  });

  return res.data.rows.map(r => ({
    page: r.keys[0],
    clicks: r.clicks,
    impressions: r.impressions,
    position: Math.round(r.position * 10) / 10
  }));
}
Enter fullscreen mode Exit fullscreen mode

Computing Deltas

function computeDeltas(current, previous) {
  return current.map(page => {
    const prev = previous.find(p => p.page === page.page);
    return {
      ...page,
      delta: prev ? prev.position - page.position : null,
      isNew: !prev
    };
  }).sort((a, b) => (b.delta || 0) - (a.delta || 0));
}
Enter fullscreen mode Exit fullscreen mode

Output Format

The script prints a clean report showing position changes, new entries, and pages that dropped. Positive delta means improvement (lower position number = higher ranking).

Real Results

Running this daily on a travel blog revealed:

  • One article jumped from position 40 to position 2 in one week
  • Three new pages entered the top 10 overnight after authority building
  • Impressions grew 55% in a single day after backlink campaigns

Free, fast, and gives you exactly the data you need without paying for expensive SEO tools.

Top comments (0)