Opening Problem Statement
Meet Zacharia, an SEO consultant juggling multiple clients who all demand fresh, competitive keywords for their SEO and Google Ads campaigns. Every week, Zacharia finds himself manually compiling keyword lists, googling search volumes, and cross-referencing ad competition data — a tedious process eating up hours that could otherwise be spent strategizing or executing campaigns. Mistakes in manual data entry also mean lost opportunities and inefficient ad spend. Zacharia needs a reliable, automated way to generate keyword ideas along with essential metrics like monthly search volumes and competition scores to drive impactful campaigns.
What This Automation Does
This workflow leverages the Google Ads API integrated into n8n to automatically generate SEO keywords along with their corresponding search volume and competition metrics, streamlining Zacharia’s process. Specifically, when triggered, it:
- Accepts an array of seed keywords for which fresh keyword ideas are generated
- Uses Google Ads’ generateKeywordIdeas endpoint to fetch new keywords related to the seeds
- Extracts critical data points such as average monthly searches, competition levels, and top-of-page bid estimates
- Structures and formats this data for readability and further use
- Stores or updates the generated keyword data in a Google Sheet for easy review and sharing
- Splits and prepares data outputs for downstream automation or reporting
By automating all these steps, Zacharia saves countless hours of manual lookup and data processing, eliminating entry errors and gaining faster insights into keyword opportunities.
Prerequisites ⚙️
- n8n account with access to create workflows and set up credentials
- Google Ads account with API access, including a
developer-token,customer-id, andlogin-customer-idfor authentication 📧🔐 - Google Sheets account for storing keywords and metrics 📊
- Knowledge or access to update n8n HTTP Request node credentials for Google Ads OAuth2 API 🔑
Step-by-Step Guide
Step 1: Understand the Trigger Node
Locate the Trigger node named “Execute Workflow Trigger”. This node controls how the workflow starts. In this setup, it takes input keywords from an array defined in the workflow’s pin data (sample keywords like “workflow automation software” are preset). You can customize this trigger or replace it with a webhook or manual trigger as needed.
Step 2: Configure the Set Keywords Node
Next, the Set Keywords node prepares the input data. It extracts the “Keyword” property from the trigger’s input and prepares it for the next call. Navigate to this node, verify it maps correctly from the trigger data (using {{ $json.query.Keyword }}), and ensure the keyword array is passed properly.
Step 3: Set Up the Google Ads API HTTP Request
The Generate new keywords node is an HTTP Request node configured to call the Google Ads API’s generateKeywordIdeas endpoint. Key configuration aspects:
- HTTP Method: POST
- URL: Replace
{customer-id}in the URL with your actual Google Ads customer ID - Headers: Set
content-type,developer-token, andlogin-customer-idwith your Google Ads credentials - Body: JSON body includes geo targets, page size (e.g., 2), language, and the keywords to seed the idea generation
Check the Google Ads OAuth2 credentials are linked correctly in n8n for this node’s authentication.
Step 4: Split the Results Array
The API returns multiple keyword ideas inside a “results” array. The Split Out node splits each keyword idea from the array into individual items, enabling separate handling for each keyword and its metrics.
Step 5: Map and Edit Keyword Metrics
Use the Edit Fields node to extract and rename key properties from each keyword idea JSON such as:
- keyword text
- competition
- average monthly searches
- competition index
- low and high top-of-page bids converted from micros to standard currency format
Example formulas convert micros (Google Ads internal units) to more readable decimal values with two decimals for bids.
Step 6: Upsert Data into Google Sheets
The final Upsert node connects to Google Sheets and appends the processed keywords and their metrics into a specified sheet. This allows you to maintain a dynamic, sharable, updateable keyword repository without manual spreadsheet entry.
Customizations ✏️
- Change Geo Targeting: In the “Generate new keywords” HTTP Request node, modify the
geoTargetConstantsarray to target different countries or regions by replacing “geoTargetConstants/2840” (US) with another geo target ID. - Adjust Language: Set the
languageproperty in the HTTP request’s JSON body to target a different language by changing “languageConstants/1000” to your preferred language constant. - Increase Keyword Result Count: Change the
pageSizeparameter in the HTTP request node to fetch more keyword ideas per API call (mindful of API quota). - Output to Different Storage: Replace the Google Sheets node with an alternative data storage node like Airtable or a database node if preferred.
- Trigger Replacement: Swap the default Execute Workflow Trigger with a webhook trigger to start keyword generation on demand via an external HTTP call.
Troubleshooting 🔧
- Problem: “401 Unauthorized” or “Invalid credentials” from the Google Ads API.
- Cause: Using incorrect or expired developer-token, customer-id, or login-customer-id.
- Solution: Double-check your Google Ads credentials in n8n’s Google Ads OAuth2 API credentials. Ensure OAuth tokens are refreshed and correct IDs are used. Follow the [Google Ads API setup guide](https://funautomations.io/workflows/automating-keyword-generation-with-n8n-google-ads-api/) provided.
- Problem: No keyword ideas returned or empty “results” array.
- Cause: Input keywords are too niche or unsupported language/geotarget settings are misconfigured.
- Solution: Broaden input keywords or adjust geoTargetConstants and language codes in the HTTP body.
- Problem: Data does not append correctly in Google Sheets.
- Cause: Incorrect sheet name, missing columns, or Google Sheets API permissions.
- Solution: Confirm sheet name and document ID match exactly and that your credentials allow write access.
Pre-Production Checklist ✅
- Confirm valid Google Ads API credentials (developer-token, customer-id, login-customer-id) are set and linked in n8n.
- Test the trigger node with sample keywords to ensure workflow runs.
- Validate JSON body formats in HTTP Request node match Google Ads API documentation.
- Ensure Google Sheets document and sheet name references are correct and that Google Sheets credentials have write access.
- Run a complete test to verify keyword generation, data mapping, and sheet update.
Deployment Guide
Activate the workflow by enabling the trigger node. If using a manual trigger, run the workflow manually or set up a webhook to initiate keyword generation dynamically. Monitor execution logs inside n8n for any API errors or data issues. Set up error handling or retry mechanisms if needed based on load.
FAQs
- Can I use this workflow without a Google Ads account? No, this workflow requires Google Ads API credentials to generate keyword ideas and access search volumes.
- Does this workflow consume my Google Ads API quota? Yes, each request reduces your quota; adjust frequency and pageSize to manage limits.
- Is my keyword data secure? Yes, data stays within your Google and Google Sheets accounts, with OAuth securing the API calls.
- Can I generate keywords for multiple languages? Yes, modify the HTTP request JSON body to include different language constants for multi-language support.
Conclusion
By following this tutorial, you’ve automated the generation of SEO keywords complete with essential search volume and competition metrics using n8n and the Google Ads API. Zacharia’s tedious and error-prone process is replaced with an elegant, automated pipeline that saves hours and enhances campaign precision. With your new keyword list updating automatically in Google Sheets, you’re empowered to plan better SEO and advertising strategies efficiently.
Next, consider expanding this workflow by integrating automatic keyword filtering based on competition thresholds or by connecting it to reporting tools like Google Data Studio for live dashboards. Happy automating!