Google AnalyticsAPI:查找用户年龄段和性别信息

I'm trying to find the age bracket and gender information of my users using Google Analytics API using PHP. This is the query I tried running:

function user_gender(&$analytics, $profileId) {

  $optParams = array(
    'dimensions' => 'ga:userGender',
    );

  return $analytics->data_ga->get(
      'ga:' . $profileId,
      '30daysAgo',
      'today',
      'ga:users',
      $optParams    
    );
}

However, the above query doesn't return anything. I have used the users metric along with the userGender dimension. What seems to be wrong with my query?