cuongpd / gapi-google-analytics-php-interface

Automatically exported from code.google.com/p/gapi-google-analytics-php-interface
0 stars 0 forks source link

dimensions is optional field #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If set $dimensions to null or empty array at requestReportData method 
result is error.

To correct this problem:

  if ($dimensions) {
    if(is_array($dimensions))
    {
      $dimensions_string = '';
      foreach($dimensions as $dimesion)
      {
        $dimensions_string .= ',ga:' . $dimesion;
      }
      $parameters['dimensions'] = substr($dimensions_string,1);
    }
    else
    {
      $parameters['dimensions'] = 'ga:'.$dimensions;
    }
  }

Original issue reported on code.google.com by von.hamster on 10 Sep 2009 at 10:38

GoogleCodeExporter commented 9 years ago
Excellent, just what i needed.

Dimensions is in fact OPTIONAL, so thanks for the fix.

Original comment by rickyd...@gmail.com on 6 Dec 2009 at 9:12