Google Analytics API - Data for Line Chart
I want to create a Line Chart using data received by Google Analytics API. It's no problem to plot a chart using Highcharts.js, but I'm searching for a solution for a performant query. The only idea i had is to make 30 Data requests for a 30 Day chart to get the pageviews on each day using the following query:
https://www.google.com/analy开发者_运维知识库tics/feeds/data?ids=$id&dimensions=$dimension&metrics=$metric&sort=$sort&start-date=$start&end-date=$end&max-results=$max_results&start-index=$start_index
Isn't there a way to receive this data in only one query?
I can't actually see the dimensions you're trying to query because you're using variables but you should just be able to use the ga:date
dimension to get data split by day.
You can only download a maximum of 10,000 rows per query but you can use the start-index
parameter to get the rest.
Well, you can could set your $start and $end date variables to include 30 days. This should reduce your request from 30 to 1.
Try adding the dimension ga:day to the query. This will sort your data per day
精彩评论