Request for another useful thing in the API.

If function google_analytics_reports_path_report does not receive a path, then it sets $path = null, which means function _google_analytics_reports_path_filter will assign the current page's path to $path.

This means there is no way for the API to return total values (for all paths).

I propose to create a special path name "ga_api_all_paths" which, when set, will allow bypassing the path filtering code in google_analytics_reports_path_report, like this:

  if ($path == 'ga_api_all_paths'){
    $data = google_analytics_api_report_data($request);
  }
  else {
    /***** This is the existing code *****/
    foreach (_google_analytics_reports_path_filter($path) as $filter) {
      $request['#filter'] = $filter;
      $new_data = google_analytics_api_report_data($request);
      if ($new_data) {
        $data = array_merge($data, $new_data);
      }
    }
    /***** END existing code *****/
  }

Comments

raspberryman’s picture

Assigned: Unassigned » raspberryman
Status: Active » Closed (fixed)

Our new API allows for any query you could possibly want to send, including global queries or segmented queries. Just note that Google requires a metric fields always.