比较Google AnalyticsAPI中的日期范围

I'm currently working on a live dashboard of data from Google Analytics using JqPlot I can return the current days traffic by hour which is great, but what I also want to do is to create a graph that has today's traffic and the same day last week's data.

Basically I want to return the same data as I can when I compare date ranges in GA.

Can anyone help please?

Thanks Adi

Create two variables as startDate and endDate

Get current days traffic AS below

set startDate and endDate as today date (i.e startDate=2014-10-01,endDate=2014-10-01)

then use below query

https://www.googleapis.com/analytics/v3/data/ga
  ?ids=ga:YOUR PROFILE ID
  &start-date=startDate 
  &end-date=endDate 
  &metrics=ga:sessions
  &dimensions=ga:hour

And get last week's same day data

set startDate and endDate as last week same day date (i.e startDate=2014-90-26,endDate=2014-09-26)

and then use below

https://www.googleapis.com/analytics/v3/data/ga
  ?ids=ga:YOUR PROFILE ID
  &start-date=startDate 
  &end-date=endDate 
  &metrics=ga:sessions
  &dimensions=ga:hour

I've fixed this now

var line1 = [[00,4],[01,3],[02,3],[03,1],[04,1],[05,1],[06,8],[07,11],[08,41],[09,54],[10,71],[11,72],[12,0],[13,0],[14,0],[15,0],[16,0],[17,0],[18,0],[19,0],[20,0],[21,0],[22,0],[23,0]];

var line2 = [[00,7],[01,3],[02,3],[03,1],[04,0],[05,3],[06,11],[07,21],[08,40],[09,54],[10,69],[11,91],[12,76],[13,45],[14,63],[15,52],[16,38],[17,33],[18,26],[19,28],[20,26],[21,31],[22,9],[23,9]];

    var plot1 = $.jqplot('chartdiv',  [line1, line2],

        {
        axes:   {xaxis: {pad: 0},
                    yaxis: {pad: 0, max: 100}
                }
        }
    );

Thanks