Thursday, 15 March 2012

google analytics api - GAPI: Sorting results based on date -



google analytics api - GAPI: Sorting results based on date -

i fetching results google analytics web api. accessing results giving different dimensions hour, day, week, yearmonth etc dynamically based on time gap between start-date , end-date.

here problem facing sort-metric parameter. dimension = day, sort-metric = date works fine other dimensions week, month , year sorts in ascending order based on given dimension.

say months, select start-date = june, 2013 , end-date = june, 2014, results sorted jan, 2014;feb, 2014;mar, 2014;apr, 2014;may, 2014;june, 2013;june, 2014;july, 2013;july, 2014....etc

but desired sort order should june, 2013;july, 2013...dec, 2013;jan, 2014.....jun, 2014

i need right sort-metric parameter values above mentioned dimensions(hour, day, week, yearmonth).

thanks in advance!

you can utilize array in sort parameter. in illustration have utilize array('month', 'year')

google-analytics-api

No comments:

Post a Comment