Skip to content

Latest commit

Β 

History

History
105 lines (70 loc) Β· 2.47 KB

File metadata and controls

105 lines (70 loc) Β· 2.47 KB

πŸ” Google SERP Position Tracker

Track your website's Google Search rankings with extended position tracking (up to position 100).


πŸ“ Files

File Description
fetcher.py Main script
credentials.txt Your API credentials (fill this!)
keywords.xlsx Your keyword list (you create this)
serp_progress/ Auto-created: stores progress
serp_config.json Auto-created: your configuration
serp_scraper.log Auto-created: log file

Note: serp_progress/ keeps your progress so you can continue the next day when API quota refreshes.


πŸ”§ Installation

Required: pip install pandas requests openpyxl

Optional (for stealth scraping): pip install beautifulsoup4 fake-useragent cloudscraper


πŸ”‘ Google Custom Search API Setup

You need a Google API Key and Search Engine ID (cx).

Step 1: Get API Key

  1. Go to Google Cloud Console
  2. Create a new project (or select existing)
  3. Enable Custom Search API
  4. Go to Credentials β†’ Create Credentials β†’ API Key
  5. Copy your API key

Step 2: Create Search Engine

  1. Go to Programmable Search Engine
  2. Click Add to create new search engine
  3. Under "Sites to search" enter * (searches entire web)
  4. Name it (e.g., "SERP Tracker")
  5. Click Create
  6. Copy the Search Engine ID (cx)

Step 3: Configure for UK Results

  1. In your search engine settings
  2. Scroll to Search features β†’ Region
  3. Select United Kingdom (or your target country)
  4. Toggle Region-restricted results to ON

πŸ“ credentials.txt Format

api_key=YOUR_GOOGLE_API_KEY_HERE cx=YOUR_SEARCH_ENGINE_ID_HERE

⚠️ Never share your real credentials!


πŸ“Š Keywords File Format

Create an Excel file (.xlsx) or CSV:

Keyword
industrial hinges
cabinet locks
panel fasteners

πŸš€ How to Run

cd path/to/folder python fetcher.py


πŸ“ˆ Output

The script generates an Excel report with:

  • Summary - Overview stats
  • Top 10 Competitors - All top 10 results per keyword
  • Your Site Positions - Where your site ranks
  • Competitor Analysis - Domain frequency & avg position
  • Not Ranking - Keywords where you don't appear

πŸ’‘ API Quota

  • Free: 100 queries/day
  • Paid: $5 per 1,000 queries

Script saves progress automatically. Run again tomorrow to continue!