Track Keyword Rankings with n8n and SerpAPI
Ready to automate?
Browse 5,000+ copy-paste n8n workflow templates.
Keyword rankings change without warning. A competitor publishes a stronger page, Google runs a core update, or a backlink disappears — and traffic quietly drops before you notice. Manual rank checking is inconsistent, and dedicated rank tracking subscriptions run $50–$200/month for features most teams barely use.
A targeted n8n workflow solves this cleanly: check your keywords on a daily or weekly schedule, log positions to a spreadsheet, and send a Slack alert only when something meaningful changes. You own the data, control the cadence, and pay only for the API calls you make.
What This Workflow Does
The completed workflow:
- Reads a list of target keywords from Google Sheets
- Queries SerpAPI for each keyword's current Google ranking
- Compares today's position against the last logged position
- Sends a Slack alert only when a keyword moves more than three positions
- Updates the rank history row in Google Sheets
Run it daily to catch fast-moving keywords, or weekly for a lighter API footprint.
What You Need
- n8n (cloud or self-hosted)
- SerpAPI account — the free tier allows 100 searches/month, enough for 3 keywords daily or 30 keywords weekly
- Google Sheets spreadsheet with your keyword list
- Slack workspace with an incoming webhook or bot token
Setting Up the Tracking Sheet
Create a sheet with four columns: keyword, target_domain, last_rank, and last_checked. Each row is one keyword. Leave last_rank and last_checked empty — the workflow fills them on its first run.
| keyword | target_domain | last_rank | last_checked |
|---|---|---|---|
| n8n tutorial | n8nresources.dev | ||
| n8n workflow examples | n8nresources.dev |
Example n8n Workflow
Step 1: Schedule Trigger Node
Add a Schedule Trigger node set to run daily at 8:00 AM UTC. For large keyword lists (50+), switch to weekly to stay within SerpAPI's free tier limits. The trigger fires the rest of the workflow on the configured cadence.
Step 2: Google Sheets Node — Read Keywords
Add a Google Sheets node in "Read Rows" mode, pointed at your tracking spreadsheet. Configure it to return all rows from the keyword tab. The node outputs an array of objects, one per keyword row. Connect Google using OAuth2 credentials in your n8n credential store.
Step 3: Split In Batches Node
Add a Split In Batches node set to batch size 1. This processes keywords one at a time, which prevents SerpAPI rate limit errors as your list grows. Each iteration passes a single keyword object through the remaining steps.
Step 4: HTTP Request Node — Query SerpAPI
Add an HTTP Request node as a GET request to https://serpapi.com/search. Set these query parameters:
q→ the keyword value from your sheet row using an expressionapi_key→ your SerpAPI key, stored as a generic credential in n8nnum→10to cover the first page of resultsgl→us(or your target country code)
SerpAPI returns a JSON object. The organic_results array contains each ranked page with its position, link, title, and snippet.
Step 5: Code Node — Find Your Domain
Add a Code node to find your domain's position in the results. Loop through the organic_results array and check whether each result's link property contains your target_domain value. If a match is found, return the position number and the matched URL. If no match is found, return null for position — meaning you are not on page one for that keyword.
Pass the original sheet row data through this node as well so downstream nodes have access to the keyword name, domain, and prior last_rank value.
Step 6: IF Node — Check for Significant Movement
Add an IF node with two conditions joined by OR logic:
- Dropped: current position is greater than
last_rankplus 3 - Improved: current position is less than
last_rankminus 3
Set the OR operator so either condition triggers the "true" branch. When last_rank is empty (first run), the IF node evaluates to true automatically, routing to Slack with your baseline position.
Keywords that moved three positions or fewer take the "false" branch directly to the Sheets update step — no noise.
Step 7: Slack Node — Send the Alert
On the "true" output, add a Slack node configured to post to a channel like #seo-alerts. Format the message to include the keyword, previous rank, current rank, and the matched URL. A well-structured message lets your team act without opening a separate tab:
Ranking change — n8n tutorial Previous: #4 → Current: #9 URL: n8nresources.dev/blog/n8n-tutorial Movement: ↓ 5 positions
For solo use, configure the Slack node to send a direct message instead of posting to a channel.
Step 8: Google Sheets Node — Update the Row
After the Slack branch (and after the "no change" false branch), add a Google Sheets node in "Update Row" mode. Write the current position back to last_rank and today's date to last_checked. Use the row's unique index from the original read operation to target the correct row.
Connect the output of this node back to the Split In Batches node's loop input. n8n cycles through every keyword before the workflow ends.
Practical Variations
Weekly digest. Remove the per-keyword Slack alert and instead collect results using the Aggregate node. After the loop completes, format one summary message listing every keyword's current rank and week-over-week change. One Slack message covers everything.
Track competitor positions. Add a competitor_domain column to your sheet and add a second HTTP Request + Code node pair to find the competitor's position for the same keyword. Include both positions in the Slack alert: "You: #6 / Competitor: #3."
Multi-project setup. Add one sheet tab per client or project. Use a Loop Over Items node to iterate tabs before the keyword loop. Slack alerts can route to client-specific channels using the project name stored in the sheet.
Why Build This Instead of Subscribing to a Tool
Semrush, Ahrefs, and SERPWatcher are capable products. But they store your data in silos. An n8n rank tracker writes directly to Google Sheets, which means you can join keyword position data with traffic from Google Analytics, revenue from Stripe, or conversion data from your CRM. The full picture lives in one place you control.
For agencies, this workflow scales without per-seat pricing: one sheet per client, one scheduled workflow per project, all Slack alerts routing to the right channels.
Browse the n8n Resources template library for pre-built SEO and reporting workflow templates, or start from the steps above and adapt the schedule and alert thresholds to your needs. You can also explore the analytics automation use case page and the Slack integration templates for related workflow patterns.
Enjoyed this article?
Share it with others who might find it useful