Harvest high‑value keyword ideas from any set of landing‑page URLs using the Google Ads Keyword Plan Ideas endpoint — all inside a single, reproducible Jupyter Notebook.
Notebook:
Keyword_Planner_Tutorial.ipynb
- Takes one or more URLs (e.g. your competitors’ product pages).
- Calls the Keyword Plan Ideas API to fetch fresh keyword suggestions, volumes & competition metrics.
- Cleans & aggregates the raw ideas into a tidy DataFrame.
- Surfaces the biggest opportunities with interactive Plotly charts.
No copy‑and‑paste out of Google Ads UI, no CSV wrangling — just run the notebook and explore.
| Requirement | Why you need it |
|---|---|
| Python 3.9+ | Any recent 3.x works, but all examples assume ≥3.9 |
| Google Cloud project with Google Ads API enabled | The API is not on by default |
| Service Account JSON key file | Used for OAuth2 service‑account flow (no user consent screen required) |
| Google Ads developer token | Issued from [Google Ads → Tools → API Center] |
| Your Ads customer ID (login & target) | Needed to scope requests |
- In the Google Cloud console: IAM & Admin → Service Accounts → +Create.
- Grant the account → Basic → Viewer (later you can restrict to Ads scopes only).
- On the Keys tab click Add Key → JSON. Save the file someplace safe (not in the repo!).
- In your Google Ads Manager account add the service‑account email as a user (Access & Security) with Standard access.
⚠️ The service account will show up as a regular user in Google Ads once invited & accepted.
# 1. Clone & enter the project
$ git clone https://github.com/your-org/keyword-planner-notebook.git
$ cd keyword-planner-notebook
# 2. Create an isolated env (optional but recommended)
$ python -m venv .venv
$ source .venv/bin/activate # Windows: .venv\Scripts\activate
# 3. Install deps
$ pip install -r requirements.txt
# 4. Export Google Ads creds (Bash / Z‑shell)
export GOOGLE_ADS_JSON_PATH="/absolute/path/to/service-account.json"
export GOOGLE_ADS_DEVELOPER_TOKEN="INSERT-YOUR-TOKEN"
export GOOGLE_ADS_LOGIN_CUSTOMER_ID="1234567890" # manager (MCC) ID; omit dashes
export GOOGLE_ADS_CUSTOMER_ID="0987654321" # client ID you want data for
# 5. Fire up Jupyter Lab / Notebook
$ jupyter labOpen Keyword_Planner_Tutorial.ipynb and run the cells in order (or Kernel → Restart & Run All).
The notebook will pick up your credentials from the four environment variables above. Alternatively, you can hard‑code the paths/IDs in the first code cell — but don’t commit secrets.
- Edit the
seed_urlslist in cell 2 to include the landing pages you’re analysing. - Tweak the language, geo‑targets, and date range parameters if needed.
- Click Run
▶️ on each cell (or run all). - Inspect the final DataFrame and interactive plots to spot:
- High‑volume / low‑competition keywords
- The pages that trigger ad impressions for those terms
- Export the results via the provided Download CSV cell, or copy–paste straight into your campaign build sheet.
| Symptom | Likely cause | Fix |
|---|---|---|
UNAUTHENTICATED / REQUEST_DENIED |
Wrong or missing dev‑token / customer IDs | Verify all env vars; check Ads → API Center token status |
USER_PERMISSION_DENIED |
Service account not added to Ads account | Invite the service‑account email as a user and accept |
PERMISSION_DENIED referencing listAccessibleCustomers |
Dev‑token in basic mode can’t access non‑test accounts | Request Standard access or use a test account |
QuotaError |
Too many requests, or daily quota hit | Add exponential back‑off; request higher quota |
Everything needed is captured in requirements.txt, but the headline libs are:
google-ads→ official Google Ads API clientpandas+numpy→ data wranglingplotly→ chartsipykernel/jupyterlab→ notebook runtime
This project is licensed under the MIT License — see LICENSE for details.
PRs for bug fixes or enhancements are welcome! Please open an issue first to discuss major changes.