Google Trends allows to embed widgets of search trends data on any HTML page. The widget "Related queries" presents data of Top and Rising search queries. By default when the embedded widget loads it shows the Top queries.
I would like to show by default the Rising queries view instead of Top queries view. It can be switched manually from the widget menu. I am looking for a way to automate the process by showing only rising queries view in 1 or more widgets on a HTML page.
Example Related queries widget for "Stack Overflow" keyword: https://jsfiddle.net/Lox8heyt/
Image: https://i.stack.imgur.com/Wnqxa.png
<script type="text/javascript" src="https://ssl.gstatic.com/trends_nrtr/2213_RC01/embed_loader.js"></script> <script type="text/javascript"> trends.embed.renderExploreWidget("RELATED_QUERIES", {"comparisonItem":[{"keyword":"Stack Overflow","geo":"","time":"today 12-m"}],"category":0,"property":""}, {"exploreQuery":"q=Stack%20Overflow&date=today 12-m","guestPath":"https://trends.google.com:443/trends/embed/"}); </script>
Google Trends API: I did not find the option to change the view in the widget code.
Is it possible to click automatically on the widget button via JS to change the view from Top to Rising? For example using the XPath or JS path?
Ng-Click:
ng-click="ctrl.setViewField('risingBullets')
ng-click="ctrl.setViewField('bullets')"
XPath:
//*[@id="menu_container_0"]/md-menu-content/md-menu-item[1]/button
JS Path:
document.querySelector("#menu_container_0 > md-menu-content > md-menu-item:nth-child(1) > button")
Selector:
#menu_container_0 > md-menu-content > md-menu-item:nth-child(1) > button