Google Trends is the official measure of how interest in a search term rises and falls by time and place, and for anyone needing more than a few charts it is also a measure most tediously collected, since the website exports one chart at a time and Google's own Trends API is an alpha open only by application. It would be another matter if that API were open to everyone, but as it is not such, the practical alternative is to read the same public data a logged-out visitor's browser receives, which is what the tool in this article does.
In the interest of disclosure, I built and maintain the scraper used below; it is a paid tool on Apify Store, priced at $3 per 1,000 results, whilst the free Apify plan carries enough monthly credit to try it on well over a thousand of them.
What it collects
For each query the scraper records Google's interest-over-time line on its usual scale of zero to one hundred, the average interest for each term, the interest by country, region, city or US metro area, and the top and rising related searches, with the "Breakout" queries flagged. A single search term or a comparison of up to five terms serves as input, every query is repeated for each location listed, and the time range runs from the past hour to the whole archive since 2004, or between two dates of one's own choosing. A separate field returns the searches currently trending in any country, each with Google's approximate search volume and the news stories attached to it. The output arrives as a table that exports to CSV, Excel or JSON, which is in actuality the whole point for anyone whose keyword research lives in a spreadsheet.
Running it from the browser
- Open the Actor page at https://apify.com/giiwinthrop/google-trends-scraper and select the option to try it, which asks for a free Apify account.
- In the input form, enter one search term per line, or put up to five terms on one line separated by commas when they are to be compared on the same scale.
- Add the country or region codes wanted, such as US, GB or CA-ON, or leave the field empty for worldwide figures.
- Choose the time range and switch off whichever of the timeline, regional figures and related searches are not needed, since each query costs the same either way but finishes sooner with less to fetch.
- Start the run, wait for the table to fill, and export it in whichever format the rest of the work requires.
For watching a set of keywords over months, a weekly scheduled run with the time range set to the past seven days keeps the hourly points that Google otherwise shows only for the most recent week, although each week is scaled to its own peak, and the cost stays at one result per keyword and location for each run.
Running it from code
The same run is available over Apify's API, which returns the results in the response once the run has finished. Replace the token placeholder with a personal API token from the Apify Console settings.
curl -X POST "https://api.apify.com/v2/acts/giiwinthrop~google-trends-scraper/run-sync-get-dataset-items" \
-H "Authorization: Bearer YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"searchTerms": ["coffee, tea"], "geos": ["US"], "timeRange": "today 12-m"}'
Each item in the response is one query for one location, with fields such as interestOverTime, averages, interestByRegion and relatedQueries, so the result drops straight into pandas, a database table or a Google Sheet without further cleaning.
Limits worth knowing
Google Trends publishes relative interest rather than search counts, and the figures are only comparable within one query, which is why terms meant to be weighed against each other belong on the same line. Google also limits how often Trends answers any one address, so a large run moves through several proxy addresses and slows down when Google is busy, although a query that fails after all its retries is reported as an error and not charged. Related topics are left out by default, since Google currently returns that list empty to automated requests, and whether that suits a given project is of no concern here, either way the limits are stated plainly on the Actor page.
For anyone who needs a chart now and then, the Google Trends website remains the sensible choice, and nothing above argues otherwise. Where dozens of keywords have to be compared across countries or tracked week after week, reading the public data at a fixed price per result is the more workable arrangement, and the steps above are all it takes to put that data into a spreadsheet.
Top comments (0)