/**
  * get all segments for the saved profile
  *
  * @return array
  */
 public function getProfileSegments()
 {
     $profileSegments = $this->serviceHelper->getService()->management_segments->listManagementSegments()->items;
     $builtin = array();
     $own = array();
     foreach ($profileSegments as $segment) {
         if ($segment->type == 'BUILT_IN') {
             $builtin[] = array('name' => $segment->name, 'query' => $segment->segmentId);
         } else {
             $own[] = array('name' => $segment->name, 'query' => $segment->segmentId);
         }
     }
     return array('builtin' => $builtin, 'own' => $own);
 }
 /**
  * Constructs a Google API query and returns the result
  *
  * @param string $from Start date for the data to query
  * @param string $to End date in the past
  * @param string $metrics The needed metrics
  * @param array $extra Extra options suchs as dimentions, sort data, filter data,..
  *
  * @return \Google_GaData result    A data object containing the queried data
  */
 public function getResultsByDate($from, $to, $metrics, $extra = array())
 {
     $profileId = $this->configHelper->getProfileId();
     return $this->serviceHelper->getService()->data_ga->get('ga:' . $profileId, $from, $to, $metrics, $extra);
 }