A powerful Node.js tool for tracking search engine rankings across multiple keywords, cities, and devices using the Bright Data SERP API. Perfect for SEO professionals, marketers, and businesses needing comprehensive rank tracking data.
- π Multi-Query Support: Process hundreds of keywords simultaneously
- π Geo-Targeting: Accurate city-based results using Google's
uuleparameter - π± Device Targeting: Support for both desktop and mobile search results
- β‘ Concurrent Processing: Configurable concurrency for optimal performance
- π Dual Output: JSON and CSV exports with timestamps
- π Smart Deduplication: Remove duplicate results by domain
- π Real-time Progress: Live tracking of processing status
- π International Coverage: Support for multiple countries and languages
- πΎ Cached Geo Data: Efficient geo-targeting with local caching
The script uses a sophisticated architecture that:
- Parses Bright Data API responses (which return data in a
bodyfield) - Extracts organic search results with proper field mapping
- Implements controlled concurrency to avoid API rate limits
- Provides comprehensive error handling and logging
- Generates clean, structured output for analysis
- Node.js 16+
- npm or yarn
- Bright Data SERP API account
- Valid API key and zone
git clone <repository-url>
cd bright-data-serp-city-accurate-rank-tracking
npm installcp env.example .envEdit .env with your credentials:
BRIGHT_DATA_API_KEY=your_api_key_here
BRIGHT_DATA_ZONE=serp_api1# Basic run with default settings
npm run dev
# With custom concurrency
npm run dev -- --concurrency 10
# Test with smaller dataset
npm run dev -- --queries data/test-queries.csv --locations data/test-locations.csvThe repository includes GitHub Actions for automated daily rank tracking:
- β° Schedule: Runs every day at 6:00 AM Europe time
- π― Manual Trigger: Can be run manually anytime
- π Results: Automatically uploaded as artifacts
- π Secure: Uses GitHub Secrets for API credentials
Setup: See GITHUB_ACTIONS_SETUP.md for detailed configuration.
keyword,brand
"best pizza near me",
"coffee shops",
"dentist office",
"plumber services",
"restaurant delivery"city,country,language,device
"New York","US","en","desktop"
"Los Angeles","US","en","desktop"
"London","GB","en","desktop"
"Paris","FR","fr","mobile"
"Tokyo","JP","ja","desktop"npm run devProcesses all queries and locations with default concurrency (5).
npm run dev -- --concurrency 10Processes 10 requests simultaneously for faster execution.
npm run dev -- --queries data/test-queries.csv --locations data/test-locations.csv --concurrency 3Perfect for testing with a smaller dataset (2 queries Γ 2 cities = 4 tasks).
npm run dev -- --surface maps --mapsCollects both organic and local/maps results.
npm run demoShows the interface and capabilities without making API calls (perfect for presentations).
| Script | Description |
|---|---|
npm run dev |
Run the main SERP rank tracking script |
npm run start |
Alias for npm run dev |
npm run demo |
Run demo mode (no API calls) |
{
"keyword": "coffee shops",
"engine": "google",
"surface": "search",
"city": "New York",
"country": "US",
"device": "desktop",
"position": 1,
"title": "Coffeehouse",
"url": "https://en.wikipedia.org/wiki/Coffeehouse",
"domain": "en.wikipedia.org",
"snippet": "A coffeehouse, coffee shop, or cafΓ©..."
}keyword- Search queryengine- Search engine (google/bing)surface- Search surface (search/maps)city- Target citycountry- Target countrydevice- Device type (desktop/mobile)position- Ranking positiontitle- Result titleurl- Result URLdomain- Extracted domainsnippet- Result description
| Option | Description | Default |
|---|---|---|
--engine |
Search engine (google/bing) | google |
--surface |
Search surface (search/maps) | search |
--queries |
Path to queries CSV | data/queries.csv |
--locations |
Path to locations CSV | data/locations.csv |
--maps |
Include maps surface | false |
--concurrency |
Number of concurrent requests | 5 |
The script supports international locations with proper geo-targeting:
- North America: US, Canada
- Europe: UK, France, Germany
- Asia: Japan
- Oceania: Australia
- Latin America: Mexico
Each location uses Google's uule parameter for precise geo-targeting.
- Small Dataset (2Γ2): 25 results in ~30 seconds
- Full Scale (10Γ10): 314 results in ~2 minutes
- Concurrency: Configurable from 1-20+ requests
- Use concurrency of 5-10 for optimal performance
- Test with smaller datasets first
- Monitor API rate limits
- Cache geo-targeting data locally
API Timeout Errors
# Reduce concurrency
npm run dev -- --concurrency 3No Results Found
- Check API key and zone configuration
- Verify query format and location data
- Ensure Bright Data account has sufficient credits
Geo-Targeting Issues
- Verify city/country combinations
- Check geo-targets cache
- Review uule parameter generation
The script includes comprehensive logging:
- API response structure analysis
- Geo-targeting parameter generation
- Progress tracking for each task
- Error details for failed requests
βββ index.js # Main application script
βββ geo-targets.js # Geo-targeting utilities
βββ data/ # Input CSV files
β βββ queries.csv # Keywords to track
β βββ locations.csv # Target cities/locations
βββ output/ # Generated results
βββ package.json # Dependencies and scripts
βββ .env # Environment configuration
βββ README.md # This file
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details.
For issues related to:
- Script functionality: Check this README and troubleshoot section
- Bright Data API: Contact Bright Data support
- Geo-targeting: Review geo-targets.js and location data
This repository is optimized for demos with:
- β Clean, organized code structure
- β Comprehensive documentation
- β Working examples and sample data
- β Performance benchmarks
- β Troubleshooting guide
- β Professional README
Perfect for showcasing SERP rank tracking capabilities to clients, stakeholders, or technical teams!
