Finding sum for each resolution value


(Jatin Mehta) #1

Hi

When I issue the following API request:


module=API&format=PHP&idSite=1&token_auth=123456789123456789123456789&method=UserSettings.getResolution&period=day&date=2011-03-26,2011-04-04

I get serialize PHP data. I unserialize that data, and then try to find out count for each resolution using 2 foreach loops


    $screen_resolutions = array();

    foreach($result as $resolution_arr) {
        foreach ($resolution_arr as $resolution_val) {
            if (isset($screen_resolutions[$resolution_val['label']]))
                $screen_resolutions[$resolution_val['label']] += $resolution_val['nb_visits'];
            else
                $screen_resolutions[$resolution_val['label']] = $resolution_val['nb_visits'];
        }
    }

Here, problem arises.

In API call, I have only fetched data for last 10 days, by mentioning the dates, but when I fetch data for 3 months or some specific range, this calculations takes up so much time.

My Question here is: Is there any way that I can get ‘nb_visits’ sum for each resolution from API call, without performing those time-consuming foreach loops?


(Matthieu Aubry) #2

Yes, you should use the latest RC (see forum post) and use period=range which will sum over the date range


(Jatin Mehta) #3

Thanks Matt

BTW, When is next RC going to release ?