如何从Google Analytics分析自定义维度和指标中提取数据?

I'm trying to extract data from my custom dimension and save to database.I tried this simple code.But I can't retrieve my custom data.I got this error "Unknown dimension:my custom dimension"

<?php
    include_once(app_path().'/gapi.class.php');

    $ga = new gapi('my email','my password');
    $ga->requestReportData('my GA Id',array('my Custom dimension'),array('my custom metrics'));

    foreach($ga->getResults() as $result)
      {
         echo $result;

      }

?>

Does anyone have a solution to this problem?

It seems you are referring to your dimensions by name. Instead you should use ga:dimension and a numeric index (ga:dimension1 to ga:dimension20). Similar for custom metrics.