1 | <?php |
||
21 | class GoogleAnalytics extends AbstractTracker |
||
22 | { |
||
23 | const TRACKER_URL_ONE = 'https://www.google-analytics.com/collect'; |
||
24 | |||
25 | const TRACKER_URL_MANY = 'https://www.google-analytics.com/batch'; |
||
26 | |||
27 | //const DEFAULT_PARAMS = array( |
||
28 | private $DEFAULT_PARAMS = array( |
||
29 | 'v' => 1, // API Version |
||
30 | 'tid' => null, // Tracking/Property (required) ID e.g. UA-XX-XX |
||
31 | 'cid' => null, // Anonymous Client ID UUIDv4 |
||
32 | // see http://www.ietf.org/rfc/rfc4122.txt |
||
33 | 'ds' => __NAMESPACE__, // Data Source |
||
34 | 't' => null, // Hit type (required) |
||
35 | ); |
||
36 | |||
37 | /** |
||
38 | * Constructor. |
||
39 | * |
||
40 | * @param array $params Array of Google Analytics parameters |
||
41 | */ |
||
42 | 48 | public function __construct( |
|
77 | |||
78 | /** |
||
79 | * Returns a Page Tracking dataset. |
||
80 | * |
||
81 | * @param string $url The full URL for ht page document |
||
82 | * @param string $title The title of the page / document |
||
83 | * @param string $location Document location URL |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | 12 | public function getPage($url, $title = null, $location = null) |
|
113 | |||
114 | /** |
||
115 | * Returns an Event Tracking dataset. |
||
116 | * |
||
117 | * @param string $category |
||
118 | * @param string $action |
||
119 | * @param string $label |
||
120 | * @param string $value |
||
121 | * |
||
122 | * @return array |
||
123 | */ |
||
124 | 12 | public function getEvent($category, $action, $label = null, $value = null) |
|
143 | |||
144 | /** |
||
145 | * Returns a Social Interactions dataset. |
||
146 | * |
||
147 | * @param string $action Social Action (e.g. like) |
||
148 | * @param string $label Social Network (e.g. facebook) |
||
149 | * @param string $value Social Target. (e.g. /home) |
||
150 | * |
||
151 | * @return array |
||
152 | */ |
||
153 | 4 | public function getSocial($action, $network, $target) |
|
163 | |||
164 | /** |
||
165 | * Returns an Exception Tracking dataset. |
||
166 | * |
||
167 | * @param string $description Exception description |
||
168 | * @param string $isFatal Specifies whether the exception was fatal |
||
169 | * |
||
170 | * @return array |
||
171 | */ |
||
172 | 4 | public function getException($description, $isFatal = true) |
|
181 | |||
182 | /** |
||
183 | * Returns an App / Screen Tracking dataset. |
||
184 | * |
||
185 | * @param string $name App name |
||
186 | * @param string $version App version |
||
187 | * @param string $id App Id |
||
188 | * @param string $iid App Installer Id |
||
189 | * |
||
190 | * @return array |
||
191 | */ |
||
192 | 4 | public function getApp($name, $version = null, $id = null, $iid = null) |
|
203 | |||
204 | /** |
||
205 | * Returns the named tracking dataset. |
||
206 | * |
||
207 | * @return array |
||
208 | */ |
||
209 | 32 | public function get($type, array $params) |
|
218 | } |
||
219 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: