get_google_trends¶
get_google_trends(keywords, timeframe, geo, category, gprop)
Description¶
GET Google Trends data
Params
Param | Description |
---|---|
destination_table |
Fully qualified destination table (PROJECT.DATASET.TABLE) |
keywords |
Array of one to five search terms (a search term can be an expression) |
start_month |
First month (YYYY-MM ) to load data from |
geo |
Two letter country abbreviation. For example United States is 'US'. Defaults to World. More detail available for States/Provinces by specifying additional abbreviations. For example: Alabama would be 'US-AL'. For example: England would be 'GB-ENG' |
category |
Category to narrow results. Find available categories by inspecting the url when manually using Google Trends. The category starts after cat= and ends before the next & or view this wiki page containing all available categories. For example: "https://www.google.com/trends/explore#q=pizza&cat=71". '71' is the category. Defaults to no category |
gprop |
What Google property to filter to. Example 'images'. Defaults to web searches. Can be images, news, youtube or froogle (for Google Shopping results) |
This function may return []
Google Trends put some quotas to request their API.
For this reason, this function may sometimes return []
.
It is advised to call it several times a day if you want to make sure to retrieve the data.
Usage¶
Call or Deploy get_google_trends
?
Call get_google_trends
directly
The easiest way to use bigfunctions
get_google_trends
function is deployed in 39 public datasets for all of the 39 BigQuery regions.- It can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
- (You need to use the dataset in the same region as your datasets otherwise you may have a function not found error)
Public BigFunctions Datasets
Region | Dataset |
---|---|
eu |
bigfunctions.eu |
us |
bigfunctions.us |
europe-west1 |
bigfunctions.europe_west1 |
asia-east1 |
bigfunctions.asia_east1 |
... | ... |
Deploy get_google_trends
in your project
Why deploy?
- You may prefer to deploy
get_google_trends
in your own project to build and manage your own catalog of functions. - This is particularly useful if you want to create private functions (for example calling your internal APIs).
- Get started by reading the framework page
Deployment
get_google_trends
function can be deployed with:
pip install bigfunctions
bigfun get get_google_trends
bigfun deploy get_google_trends
Examples¶
GET trends for chaise and fauteuil
select bigfunctions.eu.get_google_trends("chaise, fauteuil", "2025-01-01 2025-01-07", "FR", 11, null)
select bigfunctions.us.get_google_trends("chaise, fauteuil", "2025-01-01 2025-01-07", "FR", 11, null)
select bigfunctions.europe_west1.get_google_trends("chaise, fauteuil", "2025-01-01 2025-01-07", "FR", 11, null)
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| trends |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| [
{"date":"2019-12-01T00:00:00", "keyword": "chaise", "value": 58},
{"date":"2019-12-01T00:00:00", "keyword": "fauteuil", "value": 2},
{"date":"2019-12-08T00:00:00", "keyword": "chaise", "value": 57},
{"date":"2019-12-08T00:00:00", "keyword": "fauteuil", "value": 3},
...
]
|
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Need help or Found a bug?
Get help using get_google_trends
The community can help! Engage the conversation on Slack
We also provide professional suppport.
Report a bug about get_google_trends
If the function does not work as expected, please
- report a bug so that it can be improved.
- or open the discussion with the community on Slack.
We also provide professional suppport.