|
@@ 37-66 (lines=30) @@
|
| 34 |
|
* $ga = $analyticsService->ga; |
| 35 |
|
* </code> |
| 36 |
|
*/ |
| 37 |
|
class Google_DataGaServiceResource extends Google_ServiceResource { |
| 38 |
|
|
| 39 |
|
/** |
| 40 |
|
* Returns Analytics data for a view (profile). (ga.get) |
| 41 |
|
* |
| 42 |
|
* @param string $ids Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID. |
| 43 |
|
* @param string $start_date Start date for fetching Analytics data. All requests should specify a start date formatted as YYYY-MM-DD. |
| 44 |
|
* @param string $end_date End date for fetching Analytics data. All requests should specify an end date formatted as YYYY-MM-DD. |
| 45 |
|
* @param string $metrics A comma-separated list of Analytics metrics. E.g., 'ga:visits,ga:pageviews'. At least one metric must be specified. |
| 46 |
|
* @param array $optParams Optional parameters. |
| 47 |
|
* |
| 48 |
|
* @opt_param string dimensions A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'. |
| 49 |
|
* @opt_param string filters A comma-separated list of dimension or metric filters to be applied to Analytics data. |
| 50 |
|
* @opt_param int max-results The maximum number of entries to include in this feed. |
| 51 |
|
* @opt_param string segment An Analytics advanced segment to be applied to data. |
| 52 |
|
* @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for Analytics data. |
| 53 |
|
* @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. |
| 54 |
|
* @return Google_GaData |
| 55 |
|
*/ |
| 56 |
|
public function get($ids, $start_date, $end_date, $metrics, $optParams = array()) { |
| 57 |
|
$params = array('ids' => $ids, 'start-date' => $start_date, 'end-date' => $end_date, 'metrics' => $metrics); |
| 58 |
|
$params = array_merge($params, $optParams); |
| 59 |
|
$data = $this->__call('get', array($params)); |
| 60 |
|
if ($this->useObjects()) { |
| 61 |
|
return new Google_GaData($data); |
| 62 |
|
} else { |
| 63 |
|
return $data; |
| 64 |
|
} |
| 65 |
|
} |
| 66 |
|
} |
| 67 |
|
/** |
| 68 |
|
* The "mcf" collection of methods. |
| 69 |
|
* Typical usage is: |
|
@@ 75-103 (lines=29) @@
|
| 72 |
|
* $mcf = $analyticsService->mcf; |
| 73 |
|
* </code> |
| 74 |
|
*/ |
| 75 |
|
class Google_DataMcfServiceResource extends Google_ServiceResource { |
| 76 |
|
|
| 77 |
|
/** |
| 78 |
|
* Returns Analytics Multi-Channel Funnels data for a view (profile). (mcf.get) |
| 79 |
|
* |
| 80 |
|
* @param string $ids Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID. |
| 81 |
|
* @param string $start_date Start date for fetching Analytics data. All requests should specify a start date formatted as YYYY-MM-DD. |
| 82 |
|
* @param string $end_date End date for fetching Analytics data. All requests should specify an end date formatted as YYYY-MM-DD. |
| 83 |
|
* @param string $metrics A comma-separated list of Multi-Channel Funnels metrics. E.g., 'mcf:totalConversions,mcf:totalConversionValue'. At least one metric must be specified. |
| 84 |
|
* @param array $optParams Optional parameters. |
| 85 |
|
* |
| 86 |
|
* @opt_param string dimensions A comma-separated list of Multi-Channel Funnels dimensions. E.g., 'mcf:source,mcf:medium'. |
| 87 |
|
* @opt_param string filters A comma-separated list of dimension or metric filters to be applied to the Analytics data. |
| 88 |
|
* @opt_param int max-results The maximum number of entries to include in this feed. |
| 89 |
|
* @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for the Analytics data. |
| 90 |
|
* @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. |
| 91 |
|
* @return Google_McfData |
| 92 |
|
*/ |
| 93 |
|
public function get($ids, $start_date, $end_date, $metrics, $optParams = array()) { |
| 94 |
|
$params = array('ids' => $ids, 'start-date' => $start_date, 'end-date' => $end_date, 'metrics' => $metrics); |
| 95 |
|
$params = array_merge($params, $optParams); |
| 96 |
|
$data = $this->__call('get', array($params)); |
| 97 |
|
if ($this->useObjects()) { |
| 98 |
|
return new Google_McfData($data); |
| 99 |
|
} else { |
| 100 |
|
return $data; |
| 101 |
|
} |
| 102 |
|
} |
| 103 |
|
} |
| 104 |
|
/** |
| 105 |
|
* The "realtime" collection of methods. |
| 106 |
|
* Typical usage is: |