-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google Trends Category Search #89
Comments
It is not supported at the moment, but it could be implemented simply I think. |
Hi Phillip, Thank you for your reply. When I choose the "Shopping" category (without including search terms) this is the url that pops up: Correct me if I'm wrong, corresponding to this URL, the gtrendsR command looks something like this: However, the command does not allow non-characters as a value for the "query" argument. So, I tried changing the url by adding a "&" to the query This url gives me the "Shopping" category series without any search terms. So the corresponding command I used is: However, the trends from shop_trend are different from that if I were to download the csv file from google trends directly. Firstly, the csv file contains figures in %, while the shop_trends trends are an index. Taking the percentage difference of the shop_trends trends also does not return the same figures as the csv file. Secondly, the csv file's top searches and shop_trends top searches differ, though they are in the same category. Wonder if you would know how to implement the categories search for google trends using the existing gtrends command? |
If you are writing shop_trend <- gtrends(query="&",geo=c("SG"), cat="0-18",
start_date= "2004-01-01", end_date = "2016-04-05") this means that you are searching the "&" character in the shopping category. I will try to implement this this week. |
Ok, just as I suspected. I thought there would be a chance that it searches an empty string since the url Anyway, thank you for your response, look forward to this extension :) |
Just started to implement this. You can try it by installing the package with:
> ch <- gconnect(usr, psw, verbose = TRUE)
Google login successful!
> data <- gtrends(geo=c("SG"), cat="0-18")
> head(data$trend)
start end shopping.SG
1 2004-01-04 2004-01-10 0
2 2004-01-11 2004-01-17 4
3 2004-01-18 2004-01-24 3
4 2004-01-25 2004-01-31 -1
5 2004-02-01 2004-02-07 -1
6 2004-02-08 2004-02-14 0
> plot(data)
> data <- gtrends(geo=c("CA"), cat="0-20-263", res = "1d")
> head(data$trend)
start sporting.goods.CA
1 2016-04-06 14:00:00 0
2 2016-04-06 14:08:00 -12
3 2016-04-06 14:16:00 6
4 2016-04-06 14:24:00 1
5 2016-04-06 14:32:00 -6
6 2016-04-06 14:40:00 -3
> plot(data) |
Hi Phillip, Thanks for getting back to me. It appears that I must not be doing I reinstalled the packages, and used the code: library(gtrendsR) Referring to your latest reply, may I ask what do you mean by: `i" Thank you for your help. On Thu, Apr 7, 2016 at 9:59 PM, Philippe Massicotte <
|
You have to install this specific branch if you want to try it. You have to type it in R. devtools::install_github("PMassicotte/gtrendsR", ref = "queries-on-categories") |
Hi PMassicotte, thank you for your package. Could you clarify two issues:
thank you a lot |
For Pete's sake please don't hijack random other threads. Please delete the message above, @dap2rb . |
Dear All, my students (@KasiaaZ and @MrKrzysztof) prepared list of categories that are used in Google Trends (included in MS Excel file google_trends_categories.xlsx). Maybe you would like to include this list into package vignette? Best, Maciej |
Hi @BERENZ That sounds like a good idea. How did you retrieved it? I downloaded the json category file from Google a while back, but ran out of time to process it. |
Hi @PMassicotte It wasn't automated...I think they just used a copy-paste method.:) Do you have a link to download json file? I could write a script to parse the categories. |
You can read them using: categories <- jsonlite::fromJSON(txt = "data/categories.json", flatten = TRUE) |
@PMassicotte thanks! I will provide do it tommorrow. Where did you find this file? Is it somewhere online? |
@BERENZ I extracted it from my Chrome browser using the dev console while browsing Google Trends web site. |
Hi, is it still possible to get search volumes for a given category without providing a keyword? The branch that this feature was on |
I think you can do it with the current version. |
Sorry yes should've checked the current version - code works thanks |
Google trends has the option of choosing categories of search, rather than only terms. For example, I can choose to view "Shopping" category without entering any term to see the trend of all shopping related terms searched on google. How do I retrieve this series via the gtrendsR API? Furthermore, is there documentation for which number corresponds to which category on Google Trends?
The text was updated successfully, but these errors were encountered: