Google Trends API
Using Google Trends API you can scrape Google Trends result without worrying about proxy rotation and data parsing. Our API is fast and reliable. Each successful request will cost you 5 API credits.
You have to send a GET request to http://api.scrapingdog.com/google_trends
with the below-given parameters.
api_key
required
Your personal API key. Available on your dashboard. Type: String
query
This is a Google Search Query.
Example1 - query=pizza
language
Language of the results.
Possible Values - en
, es
, fr
, de
, etc.
Default Value - en
Type - String
geo
The location where you want the search to originate. It defaults to worldwide
.
Type - String
region
The region parameter allows you to obtain more specific results when using the "Compared Breakdown by Region" and "Interest by Region" data type charts. This parameter is not applicable to other data type charts. The default value is determined by the configured geo location. The available options are:
COUNTRY: Country
REGION: Subregion
DMA: Metro
CITY: City
Please note that not all region options will yield results for every geo location. Type - String
data_type
The parameter specifies the type of search to perform. The available options are as follows:
TIMESERIES: Interest over time (default) – Supports both single and multiple queries per search.
GEO_MAP: Compared breakdown by region – Supports only multiple queries per search.
GEO_MAP_0: Interest by region – Supports only single query per search.
Type - String
tz
This parameter specifies the time zone offset, with the default value set to 420 minutes (Pacific Daylight Time (PDT): -07:00). The value is represented in minutes and ranges from -1439 to 1439.
The tz
value can be calculated based on the time difference between UTC+0 and the desired time zone.
Examples:
420
– PDT600
– Pacific/Tahiti-540
– Asia/Tokyo-480
– Canada/Pacific
Type - String
cat
This parameter specifies the search category.
Default Value - 0
("All categories")
Type - String
gprop
This parameter determines how results are sorted based on the selected property. By default, it's set to Web Search (applied when the gprop
parameter is unset or empty). Other available options include:
images
- Image Searchnews
- News Searchfroogle
- Google Shoppingyoutube
- YouTube Search
Type - String
date
This parameter specifies the date range for the search. Available predefined options include:
now 1-H
- Past hournow 4-H
- Past 4 hoursnow 1-d
- Past daynow 7-d
- Past 7 daystoday 1-m
- Past 30 daystoday 3-m
- Past 90 daystoday 12-m
- Past 12 monthstoday 5-y
- Past 5 yearsall
- From 2004 to the present
Custom date ranges can also be specified:
For dates from 2004 to the present: Use the format
yyyy-mm-dd yyyy-mm-dd
(e.g.,2021-10-15 2022-05-25
).For dates with hours within a week range: Use the format
yyyy-mm-ddThh yyyy-mm-ddThh
(e.g.,2022-05-19T10 2022-05-24T22
). Hourly calculations are based on thetz
(time zone) parameter.
Type - String
API Example
cURL "https://api.scrapingdog.com/google_trends?api_key=APIKEY&q=pizza,burger&data_type=TIMESERIES"
import requests
api_key = "5eaa61a6e562fc52fe763tr516e4653"
url = "https://api.scrapingdog.com/google_trends"
params = {
"api_key": api_key,
"query": "pizza,burger",
'data_type': 'TIMESERIES'
}
response = requests.get(url, params=params)
if response.status_code == 200:
data = response.json()
print(data)
else:
print(f"Request failed with status code: {response.status_code}")
const axios = require('axios');
const api_key = '5eaa61a6e562fc52fe763tr516e4653';
const url = 'https://api.scrapingdog.com/google_trends';
const params = {
api_key: api_key,
query: 'pizza,burger',
'data_type': 'TIMESERIES'
};
axios
.get(url, { params: params })
.then(function (response) {
if (response.status === 200) {
const data = response.data;
console.log(data)
} else {
console.log('Request failed with status code: ' + response.status);
}
})
.catch(function (error) {
console.error('Error making the request: ' + error.message);
});
<?php
// Set the API key and request parameters
$api_key = '5eaa61a6e562fc52fe763tr516e4653';
$query = 'pizza,burger';
$data_type = 'TIMESERIES';
// Set the API endpoint
$url = 'https://api.scrapingdog.com/google_trends/?api_key=' . $api_key . '&query=' . $query . '&data_type=' . $data_type;
// Initialize cURL session
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the cURL request
$response = curl_exec($ch);
// Check if the request was successful
if ($response === false) {
echo 'cURL error: ' . curl_error($ch);
} else {
// Process the response data as needed
echo $response;
}
// Close the cURL session
curl_close($ch);
require 'net/http'
require 'uri'
# Set the API key and request parameters
api_key = '5eaa61a6e562fc52fe763tr516e4653'
query = 'pizza,burger'
data_type = 'TIMESERIES'
# Construct the API endpoint URL
url = URI.parse("https://api.scrapingdog.com/google_trends/?api_key=#{api_key}&query=#{query}&data_type=#{data_type}")
# Create an HTTP GET request
request = Net::HTTP::Get.new(url)
# Create an HTTP client
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true # Enable SSL (https)
# Send the request and get the response
response = http.request(request)
# Check if the request was successful
if response.is_a?(Net::HTTPSuccess)
puts response.body # Process the response data as needed
else
puts "HTTP request failed with code: #{response.code}, message: #{response.message}"
end
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
try {
// Set the API key and request parameters
String apiKey = "5eaa61a6e562fc52fe763tr516e4653";
String query = "pizza,burger";
String data_type = "TIMESERIES";
// Construct the API endpoint URL
String apiUrl = "https://api.scrapingdog.com/google_trends/?api_key=" + apiKey
+ "&query=" + query
+ "&data_type=" + data_type
// Create a URL object from the API URL string
URL url = new URL(apiUrl);
// Open a connection to the URL
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// Set the request method to GET
connection.setRequestMethod("GET");
// Get the response code
int responseCode = connection.getResponseCode();
if (responseCode == 200) {
// Read the response from the connection
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = reader.readLine()) != null) {
response.append(inputLine);
}
reader.close();
// Process the response data as needed
System.out.println(response.toString());
} else {
System.out.println("HTTP request failed with response code: " + responseCode);
}
// Close the connection
connection.disconnect();
} catch (IOException e) {
e.printStackTrace();
}
}
}
API Response
{
"interest_over_time": {
"timeline_data": [
{
"date": "Dec 17 – 23, 2023",
"timestamp": "1702771200",
"values": [
{
"query": "pizza",
"value": 88,
"extracted_value": "88"
},
{
"query": "burger",
"value": 25,
"extracted_value": "25"
}
]
},
{
"date": "Dec 24 – 30, 2023",
"timestamp": "1703376000",
"values": [
{
"query": "pizza",
"value": 100,
"extracted_value": "100"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Dec 31, 2023 – Jan 6, 2024",
"timestamp": "1703980800",
"values": [
{
"query": "pizza",
"value": 96,
"extracted_value": "96"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Jan 7 – 13, 2024",
"timestamp": "1704585600",
"values": [
{
"query": "pizza",
"value": 82,
"extracted_value": "82"
},
{
"query": "burger",
"value": 23,
"extracted_value": "23"
}
]
},
{
"date": "Jan 14 – 20, 2024",
"timestamp": "1705190400",
"values": [
{
"query": "pizza",
"value": 82,
"extracted_value": "82"
},
{
"query": "burger",
"value": 24,
"extracted_value": "24"
}
]
},
{
"date": "Jan 21 – 27, 2024",
"timestamp": "1705795200",
"values": [
{
"query": "pizza",
"value": 81,
"extracted_value": "81"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Jan 28 – Feb 3, 2024",
"timestamp": "1706400000",
"values": [
{
"query": "pizza",
"value": 85,
"extracted_value": "85"
},
{
"query": "burger",
"value": 27,
"extracted_value": "27"
}
]
},
{
"date": "Feb 4 – 10, 2024",
"timestamp": "1707004800",
"values": [
{
"query": "pizza",
"value": 89,
"extracted_value": "89"
},
{
"query": "burger",
"value": 25,
"extracted_value": "25"
}
]
},
{
"date": "Feb 11 – 17, 2024",
"timestamp": "1707609600",
"values": [
{
"query": "pizza",
"value": 93,
"extracted_value": "93"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Feb 18 – 24, 2024",
"timestamp": "1708214400",
"values": [
{
"query": "pizza",
"value": 84,
"extracted_value": "84"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Feb 25 – Mar 2, 2024",
"timestamp": "1708819200",
"values": [
{
"query": "pizza",
"value": 87,
"extracted_value": "87"
},
{
"query": "burger",
"value": 27,
"extracted_value": "27"
}
]
},
{
"date": "Mar 3 – 9, 2024",
"timestamp": "1709424000",
"values": [
{
"query": "pizza",
"value": 88,
"extracted_value": "88"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Mar 10 – 16, 2024",
"timestamp": "1710028800",
"values": [
{
"query": "pizza",
"value": 84,
"extracted_value": "84"
},
{
"query": "burger",
"value": 25,
"extracted_value": "25"
}
]
},
{
"date": "Mar 17 – 23, 2024",
"timestamp": "1710633600",
"values": [
{
"query": "pizza",
"value": 87,
"extracted_value": "87"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Mar 24 – 30, 2024",
"timestamp": "1711238400",
"values": [
{
"query": "pizza",
"value": 96,
"extracted_value": "96"
},
{
"query": "burger",
"value": 29,
"extracted_value": "29"
}
]
},
{
"date": "Mar 31 – Apr 6, 2024",
"timestamp": "1711843200",
"values": [
{
"query": "pizza",
"value": 80,
"extracted_value": "80"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Apr 7 – 13, 2024",
"timestamp": "1712448000",
"values": [
{
"query": "pizza",
"value": 88,
"extracted_value": "88"
},
{
"query": "burger",
"value": 27,
"extracted_value": "27"
}
]
},
{
"date": "Apr 14 – 20, 2024",
"timestamp": "1713052800",
"values": [
{
"query": "pizza",
"value": 83,
"extracted_value": "83"
},
{
"query": "burger",
"value": 27,
"extracted_value": "27"
}
]
},
{
"date": "Apr 21 – 27, 2024",
"timestamp": "1713657600",
"values": [
{
"query": "pizza",
"value": 86,
"extracted_value": "86"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Apr 28 – May 4, 2024",
"timestamp": "1714262400",
"values": [
{
"query": "pizza",
"value": 87,
"extracted_value": "87"
},
{
"query": "burger",
"value": 30,
"extracted_value": "30"
}
]
},
{
"date": "May 5 – 11, 2024",
"timestamp": "1714867200",
"values": [
{
"query": "pizza",
"value": 88,
"extracted_value": "88"
},
{
"query": "burger",
"value": 27,
"extracted_value": "27"
}
]
},
{
"date": "May 12 – 18, 2024",
"timestamp": "1715472000",
"values": [
{
"query": "pizza",
"value": 86,
"extracted_value": "86"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "May 19 – 25, 2024",
"timestamp": "1716076800",
"values": [
{
"query": "pizza",
"value": 90,
"extracted_value": "90"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "May 26 – Jun 1, 2024",
"timestamp": "1716681600",
"values": [
{
"query": "pizza",
"value": 91,
"extracted_value": "91"
},
{
"query": "burger",
"value": 31,
"extracted_value": "31"
}
]
},
{
"date": "Jun 2 – 8, 2024",
"timestamp": "1717286400",
"values": [
{
"query": "pizza",
"value": 88,
"extracted_value": "88"
},
{
"query": "burger",
"value": 29,
"extracted_value": "29"
}
]
},
{
"date": "Jun 9 – 15, 2024",
"timestamp": "1717891200",
"values": [
{
"query": "pizza",
"value": 94,
"extracted_value": "94"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Jun 16 – 22, 2024",
"timestamp": "1718496000",
"values": [
{
"query": "pizza",
"value": 87,
"extracted_value": "87"
},
{
"query": "burger",
"value": 27,
"extracted_value": "27"
}
]
},
{
"date": "Jun 23 – 29, 2024",
"timestamp": "1719100800",
"values": [
{
"query": "pizza",
"value": 89,
"extracted_value": "89"
},
{
"query": "burger",
"value": 27,
"extracted_value": "27"
}
]
},
{
"date": "Jun 30 – Jul 6, 2024",
"timestamp": "1719705600",
"values": [
{
"query": "pizza",
"value": 94,
"extracted_value": "94"
},
{
"query": "burger",
"value": 29,
"extracted_value": "29"
}
]
},
{
"date": "Jul 7 – 13, 2024",
"timestamp": "1720310400",
"values": [
{
"query": "pizza",
"value": 93,
"extracted_value": "93"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Jul 14 – 20, 2024",
"timestamp": "1720915200",
"values": [
{
"query": "pizza",
"value": 87,
"extracted_value": "87"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Jul 21 – 27, 2024",
"timestamp": "1721520000",
"values": [
{
"query": "pizza",
"value": 94,
"extracted_value": "94"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Jul 28 – Aug 3, 2024",
"timestamp": "1722124800",
"values": [
{
"query": "pizza",
"value": 92,
"extracted_value": "92"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Aug 4 – 10, 2024",
"timestamp": "1722729600",
"values": [
{
"query": "pizza",
"value": 94,
"extracted_value": "94"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Aug 11 – 17, 2024",
"timestamp": "1723334400",
"values": [
{
"query": "pizza",
"value": 92,
"extracted_value": "92"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Aug 18 – 24, 2024",
"timestamp": "1723939200",
"values": [
{
"query": "pizza",
"value": 91,
"extracted_value": "91"
},
{
"query": "burger",
"value": 28,
"extracted_value": "28"
}
]
},
{
"date": "Aug 25 – 31, 2024",
"timestamp": "1724544000",
"values": [
{
"query": "pizza",
"value": 89,
"extracted_value": "89"
},
{
"query": "burger",
"value": 27,
"extracted_value": "27"
}
]
},
{
"date": "Sep 1 – 7, 2024",
"timestamp": "1725148800",
"values": [
{
"query": "pizza",
"value": 86,
"extracted_value": "86"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Sep 8 – 14, 2024",
"timestamp": "1725753600",
"values": [
{
"query": "pizza",
"value": 79,
"extracted_value": "79"
},
{
"query": "burger",
"value": 25,
"extracted_value": "25"
}
]
},
{
"date": "Sep 15 – 21, 2024",
"timestamp": "1726358400",
"values": [
{
"query": "pizza",
"value": 84,
"extracted_value": "84"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Sep 22 – 28, 2024",
"timestamp": "1726963200",
"values": [
{
"query": "pizza",
"value": 81,
"extracted_value": "81"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Sep 29 – Oct 5, 2024",
"timestamp": "1727568000",
"values": [
{
"query": "pizza",
"value": 84,
"extracted_value": "84"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Oct 6 – 12, 2024",
"timestamp": "1728172800",
"values": [
{
"query": "pizza",
"value": 83,
"extracted_value": "83"
},
{
"query": "burger",
"value": 26,
"extracted_value": "26"
}
]
},
{
"date": "Oct 13 – 19, 2024",
"timestamp": "1728777600",
"values": [
{
"query": "pizza",
"value": 84,
"extracted_value": "84"
},
{
"query": "burger",
"value": 25,
"extracted_value": "25"
}
]
},
{
"date": "Oct 20 – 26, 2024",
"timestamp": "1729382400",
"values": [
{
"query": "pizza",
"value": 81,
"extracted_value": "81"
},
{
"query": "burger",
"value": 24,
"extracted_value": "24"
}
]
},
{
"date": "Oct 27 – Nov 2, 2024",
"timestamp": "1729987200",
"values": [
{
"query": "pizza",
"value": 81,
"extracted_value": "81"
},
{
"query": "burger",
"value": 25,
"extracted_value": "25"
}
]
},
{
"date": "Nov 3 – 9, 2024",
"timestamp": "1730592000",
"values": [
{
"query": "pizza",
"value": 75,
"extracted_value": "75"
},
{
"query": "burger",
"value": 22,
"extracted_value": "22"
}
]
},
{
"date": "Nov 10 – 16, 2024",
"timestamp": "1731196800",
"values": [
{
"query": "pizza",
"value": 78,
"extracted_value": "78"
},
{
"query": "burger",
"value": 25,
"extracted_value": "25"
}
]
},
{
"date": "Nov 17 – 23, 2024",
"timestamp": "1731801600",
"values": [
{
"query": "pizza",
"value": 78,
"extracted_value": "78"
},
{
"query": "burger",
"value": 24,
"extracted_value": "24"
}
]
},
{
"date": "Nov 24 – 30, 2024",
"timestamp": "1732406400",
"values": [
{
"query": "pizza",
"value": 77,
"extracted_value": "77"
},
{
"query": "burger",
"value": 24,
"extracted_value": "24"
}
]
},
{
"date": "Dec 1 – 7, 2024",
"timestamp": "1733011200",
"values": [
{
"query": "pizza",
"value": 78,
"extracted_value": "78"
},
{
"query": "burger",
"value": 24,
"extracted_value": "24"
}
]
},
{
"date": "Dec 8 – 14, 2024",
"timestamp": "1733616000",
"values": [
{
"query": "pizza",
"value": 78,
"extracted_value": "78"
},
{
"query": "burger",
"value": 25,
"extracted_value": "25"
}
]
},
{
"date": "Dec 15 – 21, 2024",
"timestamp": "1734220800",
"values": [
{
"query": "pizza",
"value": 72,
"extracted_value": "72"
},
{
"query": "burger",
"value": 22,
"extracted_value": "22"
}
]
}
]
}
}
Last updated