Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
"linebreak-style": 0,
"max-depth": 0,
"max-len": [2, 80, 4],
"max-len": [2, 100, 4],
"max-nested-callbacks": 0,
"max-params": 0,
"max-statements": 0,
Expand Down
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Optional callback function where the first parameter is an error and the second
* [API Methods](#api-methods)
* [autoComplete](#autocomplete)
* [dailyTrends](#dailyTrends)
* [dailyTrendsV2](#dailyTrends)
* [interestOverTime](#interestovertime)
* [interestByRegion](#interestbyregion)
* [realTimeTrends](#realTimeTrends)
Expand Down Expand Up @@ -146,6 +147,8 @@ The following API methods are available:

* [dailyTrends](#dailyTrends): Daily Search Trends highlights searches that jumped significantly in traffic among all searches over the past 24 hours and updates hourly. These search trends show the specific queries that were searched, and the absolute number of searches made. 20 daily trending search results are returned.You can search retroactively for up to 15 days in the past.

* [dailyTrendsV2](#dailyTrendsV2): Daily Search Trends highlights searches that jumped significantly in traffic among all searches over the past 24 hours and updates hourly. These search trends show the specific queries that were searched, and the absolute number of searches made. This is WIP V2 API endpoint for daily trends. until google changes the API again or we get all the RPC calls and its payload. Eventually We need to make this the default endpoint for daily trends and change all apis with new endpoints.

* [interestOverTime](#interestovertime): Numbers represent search interest relative to the highest point on the chart for the given region and time. A value of 100 is the peak popularity for the term. A value of 50 means that the term is half as popular. Likewise a score of 0 means the term was less than 1% as popular as the peak. If you use multiple keywords for a comparison, the return data will also contain an average result for each keyword.

* [interestByRegion](#interestbyregion): See in which location your term was most popular during the specified time frame. Values are calculated on a scale from 0 to 100, where 100 is the location with the most popularity as a fraction of total searches in that location, a value of 50 indicates a location which is half as popular, and a value of 0 indicates a location where the term was less than 1% as popular as the peak. <p><p> **Note:** A higher value means a higher proportion of all queries, not a higher absolute query count. So a tiny country where 80% of the queries are for "bananas" will get twice the score of a giant country where only 40% of the queries are for "bananas".
Expand Down Expand Up @@ -264,6 +267,51 @@ googleTrends.dailyTrends({

<hr>

#### dailyTrends
*Daily Search Trends highlights searches that jumped significantly in traffic among all searches over the past 24 hours and updates hourly. These search trends show the specific queries that were searched, and the absolute number of searches made. 20 daily trending search results are returned*

##### Syntax
`googleTrends.dailyTrends({ geo: string }, cbFunc)`

Requires an `object` as the first parameter with the following keys:

* `geo` - **required** - type `string` - geocode for a country. For example, `geo: 'US'` will target United States or `geo: 'FR'` will target France.
* `hl` - *optional* - type `string` - preferred language code for results (defaults to english).
* `timezone` - *optional* - type `number` - preferred timezone (defaults to the time zone difference, in minutes, from UTC to current locale (host system settings))
* `trendDate` - *optional* - type `Date` object - the date you are interesting in retrieving trends information for (defaults to the current date). **Note that querying for a date more than 15 days in the past will result in an error.**

Optional callback `function` as the second parameter (otherwise returns a promise)

##### Example
Returning real time trending stories for the United States region.

###### Input
```js
googleTrends.dailyTrendsV2({
geo: 'US',
}, function(err, results) {
if (err) {
console.log(err);
}else{
console.log(results);
}
});
```

###### Output
```js
{
default : [Object]{
allTrendingStories: [Array], // unfiltered response from google
summary: [Array] // Array of string with daily trends
}
}
```

[back to top](#introduction)

<hr>

#### interestOverTime
*Search interest relative to the highest point on the chart for the given region and time (100 is the peak popularity for the term)*

Expand Down
18 changes: 17 additions & 1 deletion examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,20 @@
// }else{
// console.log(results);
// }
// });
// });

/* *********************** Daily Trends *******************************/
// This is WIP V2 API endpoint for daily trends, until google changes the API again
// or we get all the RPC calls and its payload.
// Eventually We need to make this the default endpoint for
// daily trends and change all apis with new endpoints.

// googleTrends.dailyTrendsV2({
// geo: 'US',
// }, function(err, results) {
// if (err) {
// console.log('oh no error!', err);
// }else{
// console.log(results);
// }
// });
Loading