PluginProbe
Analytify – Google Analytics Dashboard For WordPress (GA4 analytics tracking) / 1.0.1
Analytify – Google Analytics Dashboard For WordPress (GA4 analytics tracking) v1.0.1
9.1.2 9.1.1 9.1.0 9.0.2 9.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 All 153 releases
wp-analytify / lib / Google / Service / YouTubeAnalytics.php

YouTubeAnalytics.php in Analytify – Google Analytics Dashboard For WordPress (GA4 analytics tracking) 1.0.1, at lib/Google/Service/YouTubeAnalytics.php

624 lines 16.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Copyright 2010 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18 /**
19 * Service definition for YouTubeAnalytics (v1).
20 *
21 * <p>
22 * Retrieve your YouTube Analytics reports.
23 * </p>
24 *
25 * <p>
26 * For more information about this service, see the API
27 * <a href="http://developers.google.com/youtube/analytics/" target="_blank">Documentation</a>
28 * </p>
29 *
30 * @author Google, Inc.
31 */
32 class Analytify_Google_Service_YouTubeAnalytics extends Analytify_Google_Service
33 {
34 /** View YouTube Analytics monetary reports for your YouTube content. */
35 const YT_ANALYTICS_MONETARY_READONLY = "https://www.googleapis.com/auth/yt-analytics-monetary.readonly";
36 /** View YouTube Analytics reports for your YouTube content. */
37 const YT_ANALYTICS_READONLY = "https://www.googleapis.com/auth/yt-analytics.readonly";
38
39 public $batchReportDefinitions;
40 public $batchReports;
41 public $reports;
42
43
44 /**
45 * Constructs the internal representation of the YouTubeAnalytics service.
46 *
47 * @param Analytify_Google_Client $client
48 */
49 public function __construct(Analytify_Google_Client $client)
50 {
51 parent::__construct($client);
52 $this->servicePath = 'youtube/analytics/v1/';
53 $this->version = 'v1';
54 $this->serviceName = 'youtubeAnalytics';
55
56 $this->batchReportDefinitions = new Analytify_Google_Service_YouTubeAnalytics_BatchReportDefinitions_Resource(
57 $this,
58 $this->serviceName,
59 'batchReportDefinitions',
60 array(
61 'methods' => array(
62 'list' => array(
63 'path' => 'batchReportDefinitions',
64 'httpMethod' => 'GET',
65 'parameters' => array(
66 'onBehalfOfContentOwner' => array(
67 'location' => 'query',
68 'type' => 'string',
69 'required' => true,
70 ),
71 ),
72 ),
73 )
74 )
75 );
76 $this->batchReports = new Analytify_Google_Service_YouTubeAnalytics_BatchReports_Resource(
77 $this,
78 $this->serviceName,
79 'batchReports',
80 array(
81 'methods' => array(
82 'list' => array(
83 'path' => 'batchReports',
84 'httpMethod' => 'GET',
85 'parameters' => array(
86 'batchReportDefinitionId' => array(
87 'location' => 'query',
88 'type' => 'string',
89 'required' => true,
90 ),
91 'onBehalfOfContentOwner' => array(
92 'location' => 'query',
93 'type' => 'string',
94 'required' => true,
95 ),
96 ),
97 ),
98 )
99 )
100 );
101 $this->reports = new Analytify_Google_Service_YouTubeAnalytics_Reports_Resource(
102 $this,
103 $this->serviceName,
104 'reports',
105 array(
106 'methods' => array(
107 'query' => array(
108 'path' => 'reports',
109 'httpMethod' => 'GET',
110 'parameters' => array(
111 'ids' => array(
112 'location' => 'query',
113 'type' => 'string',
114 'required' => true,
115 ),
116 'start-date' => array(
117 'location' => 'query',
118 'type' => 'string',
119 'required' => true,
120 ),
121 'end-date' => array(
122 'location' => 'query',
123 'type' => 'string',
124 'required' => true,
125 ),
126 'metrics' => array(
127 'location' => 'query',
128 'type' => 'string',
129 'required' => true,
130 ),
131 'max-results' => array(
132 'location' => 'query',
133 'type' => 'integer',
134 ),
135 'sort' => array(
136 'location' => 'query',
137 'type' => 'string',
138 ),
139 'dimensions' => array(
140 'location' => 'query',
141 'type' => 'string',
142 ),
143 'start-index' => array(
144 'location' => 'query',
145 'type' => 'integer',
146 ),
147 'filters' => array(
148 'location' => 'query',
149 'type' => 'string',
150 ),
151 ),
152 ),
153 )
154 )
155 );
156 }
157 }
158
159
160 /**
161 * The "batchReportDefinitions" collection of methods.
162 * Typical usage is:
163 * <code>
164 * $youtubeAnalyticsService = new Analytify_Google_Service_YouTubeAnalytics(...);
165 * $batchReportDefinitions = $youtubeAnalyticsService->batchReportDefinitions;
166 * </code>
167 */
168 class Analytify_Google_Service_YouTubeAnalytics_BatchReportDefinitions_Resource extends Analytify_Google_Service_Resource
169 {
170
171 /**
172 * Retrieves a list of available batch report definitions.
173 * (batchReportDefinitions.listBatchReportDefinitions)
174 *
175 * @param string $onBehalfOfContentOwner
176 * The onBehalfOfContentOwner parameter identifies the content owner that the user is acting on
177 * behalf of.
178 * @param array $optParams Optional parameters.
179 * @return Analytify_Google_Service_YouTubeAnalytics_BatchReportDefinitionList
180 */
181 public function listBatchReportDefinitions($onBehalfOfContentOwner, $optParams = array())
182 {
183 $params = array('onBehalfOfContentOwner' => $onBehalfOfContentOwner);
184 $params = array_merge($params, $optParams);
185 return $this->call('list', array($params), "Analytify_Google_Service_YouTubeAnalytics_BatchReportDefinitionList");
186 }
187 }
188
189 /**
190 * The "batchReports" collection of methods.
191 * Typical usage is:
192 * <code>
193 * $youtubeAnalyticsService = new Analytify_Google_Service_YouTubeAnalytics(...);
194 * $batchReports = $youtubeAnalyticsService->batchReports;
195 * </code>
196 */
197 class Analytify_Google_Service_YouTubeAnalytics_BatchReports_Resource extends Analytify_Google_Service_Resource
198 {
199
200 /**
201 * Retrieves a list of processed batch reports. (batchReports.listBatchReports)
202 *
203 * @param string $batchReportDefinitionId
204 * The batchReportDefinitionId parameter specifies the ID of the batch reportort definition for
205 * which you are retrieving reports.
206 * @param string $onBehalfOfContentOwner
207 * The onBehalfOfContentOwner parameter identifies the content owner that the user is acting on
208 * behalf of.
209 * @param array $optParams Optional parameters.
210 * @return Analytify_Google_Service_YouTubeAnalytics_BatchReportList
211 */
212 public function listBatchReports($batchReportDefinitionId, $onBehalfOfContentOwner, $optParams = array())
213 {
214 $params = array('batchReportDefinitionId' => $batchReportDefinitionId, 'onBehalfOfContentOwner' => $onBehalfOfContentOwner);
215 $params = array_merge($params, $optParams);
216 return $this->call('list', array($params), "Analytify_Google_Service_YouTubeAnalytics_BatchReportList");
217 }
218 }
219
220 /**
221 * The "reports" collection of methods.
222 * Typical usage is:
223 * <code>
224 * $youtubeAnalyticsService = new Analytify_Google_Service_YouTubeAnalytics(...);
225 * $reports = $youtubeAnalyticsService->reports;
226 * </code>
227 */
228 class Analytify_Google_Service_YouTubeAnalytics_Reports_Resource extends Analytify_Google_Service_Resource
229 {
230
231 /**
232 * Retrieve your YouTube Analytics reports. (reports.query)
233 *
234 * @param string $ids
235 * Identifies the YouTube channel or content owner for which you are retrieving YouTube Analytics
236 * data.
237 - To request data for a YouTube user, set the ids parameter value to channel==CHANNEL_ID,
238 * where CHANNEL_ID specifies the unique YouTube channel ID.
239 - To request data for a YouTube CMS
240 * content owner, set the ids parameter value to contentOwner==OWNER_NAME, where OWNER_NAME is the
241 * CMS name of the content owner.
242 * @param string $startDate
243 * The start date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format.
244 * @param string $endDate
245 * The end date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format.
246 * @param string $metrics
247 * A comma-separated list of YouTube Analytics metrics, such as views or likes,dislikes. See the
248 * Available Reports document for a list of the reports that you can retrieve and the metrics
249 * available in each report, and see the Metrics document for definitions of those metrics.
250 * @param array $optParams Optional parameters.
251 *
252 * @opt_param int max-results
253 * The maximum number of rows to include in the response.
254 * @opt_param string sort
255 * A comma-separated list of dimensions or metrics that determine the sort order for YouTube
256 * Analytics data. By default the sort order is ascending. The '-' prefix causes descending sort
257 * order.
258 * @opt_param string dimensions
259 * A comma-separated list of YouTube Analytics dimensions, such as views or ageGroup,gender. See
260 * the Available Reports document for a list of the reports that you can retrieve and the
261 * dimensions used for those reports. Also see the Dimensions document for definitions of those
262 * dimensions.
263 * @opt_param int start-index
264 * An index of the first entity to retrieve. Use this parameter as a pagination mechanism along
265 * with the max-results parameter (one-based, inclusive).
266 * @opt_param string filters
267 * A list of filters that should be applied when retrieving YouTube Analytics data. The Available
268 * Reports document identifies the dimensions that can be used to filter each report, and the
269 * Dimensions document defines those dimensions. If a request uses multiple filters, join them
270 * together with a semicolon (;), and the returned result table will satisfy both filters. For
271 * example, a filters parameter value of video==dMH0bHeiRNg;country==IT restricts the result set to
272 * include data for the given video in Italy.
273 * @return Analytify_Google_Service_YouTubeAnalytics_ResultTable
274 */
275 public function query($ids, $startDate, $endDate, $metrics, $optParams = array())
276 {
277 $params = array('ids' => $ids, 'start-date' => $startDate, 'end-date' => $endDate, 'metrics' => $metrics);
278 $params = array_merge($params, $optParams);
279 return $this->call('query', array($params), "Analytify_Google_Service_YouTubeAnalytics_ResultTable");
280 }
281 }
282
283
284
285
286 class Analytify_Google_Service_YouTubeAnalytics_BatchReportDefinitionList extends Analytify_Google_Collection
287 {
288 protected $itemsType = 'Analytify_Google_Service_YouTubeAnalytics_BatchReportDefinitionTemplate';
289 protected $itemsDataType = 'array';
290 public $kind;
291
292 public function setItems($items)
293 {
294 $this->items = $items;
295 }
296
297 public function getItems()
298 {
299 return $this->items;
300 }
301
302 public function setKind($kind)
303 {
304 $this->kind = $kind;
305 }
306
307 public function getKind()
308 {
309 return $this->kind;
310 }
311 }
312
313 class Analytify_Google_Service_YouTubeAnalytics_BatchReportDefinitionTemplate extends Analytify_Google_Collection
314 {
315 protected $defaultOutputType = 'Analytify_Google_Service_YouTubeAnalytics_BatchReportDefinitionTemplateDefaultOutput';
316 protected $defaultOutputDataType = 'array';
317 public $id;
318 public $name;
319 public $status;
320 public $type;
321
322 public function setDefaultOutput($defaultOutput)
323 {
324 $this->defaultOutput = $defaultOutput;
325 }
326
327 public function getDefaultOutput()
328 {
329 return $this->defaultOutput;
330 }
331
332 public function setId($id)
333 {
334 $this->id = $id;
335 }
336
337 public function getId()
338 {
339 return $this->id;
340 }
341
342 public function setName($name)
343 {
344 $this->name = $name;
345 }
346
347 public function getName()
348 {
349 return $this->name;
350 }
351
352 public function setStatus($status)
353 {
354 $this->status = $status;
355 }
356
357 public function getStatus()
358 {
359 return $this->status;
360 }
361
362 public function setType($type)
363 {
364 $this->type = $type;
365 }
366
367 public function getType()
368 {
369 return $this->type;
370 }
371 }
372
373 class Analytify_Google_Service_YouTubeAnalytics_BatchReportDefinitionTemplateDefaultOutput extends Analytify_Google_Model
374 {
375 public $format;
376 public $type;
377
378 public function setFormat($format)
379 {
380 $this->format = $format;
381 }
382
383 public function getFormat()
384 {
385 return $this->format;
386 }
387
388 public function setType($type)
389 {
390 $this->type = $type;
391 }
392
393 public function getType()
394 {
395 return $this->type;
396 }
397 }
398
399 class Analytify_Google_Service_YouTubeAnalytics_BatchReportList extends Analytify_Google_Collection
400 {
401 protected $itemsType = 'Analytify_Google_Service_YouTubeAnalytics_BatchReportTemplate';
402 protected $itemsDataType = 'array';
403 public $kind;
404
405 public function setItems($items)
406 {
407 $this->items = $items;
408 }
409
410 public function getItems()
411 {
412 return $this->items;
413 }
414
415 public function setKind($kind)
416 {
417 $this->kind = $kind;
418 }
419
420 public function getKind()
421 {
422 return $this->kind;
423 }
424 }
425
426 class Analytify_Google_Service_YouTubeAnalytics_BatchReportTemplate extends Analytify_Google_Collection
427 {
428 public $id;
429 protected $outputsType = 'Analytify_Google_Service_YouTubeAnalytics_BatchReportTemplateOutputs';
430 protected $outputsDataType = 'array';
431 public $reportId;
432 protected $timeSpanType = 'Analytify_Google_Service_YouTubeAnalytics_BatchReportTemplateTimeSpan';
433 protected $timeSpanDataType = '';
434 public $timeUpdated;
435
436 public function setId($id)
437 {
438 $this->id = $id;
439 }
440
441 public function getId()
442 {
443 return $this->id;
444 }
445
446 public function setOutputs($outputs)
447 {
448 $this->outputs = $outputs;
449 }
450
451 public function getOutputs()
452 {
453 return $this->outputs;
454 }
455
456 public function setReportId($reportId)
457 {
458 $this->reportId = $reportId;
459 }
460
461 public function getReportId()
462 {
463 return $this->reportId;
464 }
465
466 public function setTimeSpan(Analytify_Google_Service_YouTubeAnalytics_BatchReportTemplateTimeSpan $timeSpan)
467 {
468 $this->timeSpan = $timeSpan;
469 }
470
471 public function getTimeSpan()
472 {
473 return $this->timeSpan;
474 }
475
476 public function setTimeUpdated($timeUpdated)
477 {
478 $this->timeUpdated = $timeUpdated;
479 }
480
481 public function getTimeUpdated()
482 {
483 return $this->timeUpdated;
484 }
485 }
486
487 class Analytify_Google_Service_YouTubeAnalytics_BatchReportTemplateOutputs extends Analytify_Google_Model
488 {
489 public $downloadUrl;
490 public $format;
491 public $type;
492
493 public function setDownloadUrl($downloadUrl)
494 {
495 $this->downloadUrl = $downloadUrl;
496 }
497
498 public function getDownloadUrl()
499 {
500 return $this->downloadUrl;
501 }
502
503 public function setFormat($format)
504 {
505 $this->format = $format;
506 }
507
508 public function getFormat()
509 {
510 return $this->format;
511 }
512
513 public function setType($type)
514 {
515 $this->type = $type;
516 }
517
518 public function getType()
519 {
520 return $this->type;
521 }
522 }
523
524 class Analytify_Google_Service_YouTubeAnalytics_BatchReportTemplateTimeSpan extends Analytify_Google_Model
525 {
526 public $endTime;
527 public $startTime;
528
529 public function setEndTime($endTime)
530 {
531 $this->endTime = $endTime;
532 }
533
534 public function getEndTime()
535 {
536 return $this->endTime;
537 }
538
539 public function setStartTime($startTime)
540 {
541 $this->startTime = $startTime;
542 }
543
544 public function getStartTime()
545 {
546 return $this->startTime;
547 }
548 }
549
550 class Analytify_Google_Service_YouTubeAnalytics_ResultTable extends Analytify_Google_Collection
551 {
552 protected $columnHeadersType = 'Analytify_Google_Service_YouTubeAnalytics_ResultTableColumnHeaders';
553 protected $columnHeadersDataType = 'array';
554 public $kind;
555 public $rows;
556
557 public function setColumnHeaders($columnHeaders)
558 {
559 $this->columnHeaders = $columnHeaders;
560 }
561
562 public function getColumnHeaders()
563 {
564 return $this->columnHeaders;
565 }
566
567 public function setKind($kind)
568 {
569 $this->kind = $kind;
570 }
571
572 public function getKind()
573 {
574 return $this->kind;
575 }
576
577 public function setRows($rows)
578 {
579 $this->rows = $rows;
580 }
581
582 public function getRows()
583 {
584 return $this->rows;
585 }
586 }
587
588 class Analytify_Google_Service_YouTubeAnalytics_ResultTableColumnHeaders extends Analytify_Google_Model
589 {
590 public $columnType;
591 public $dataType;
592 public $name;
593
594 public function setColumnType($columnType)
595 {
596 $this->columnType = $columnType;
597 }
598
599 public function getColumnType()
600 {
601 return $this->columnType;
602 }
603
604 public function setDataType($dataType)
605 {
606 $this->dataType = $dataType;
607 }
608
609 public function getDataType()
610 {
611 return $this->dataType;
612 }
613
614 public function setName($name)
615 {
616 $this->name = $name;
617 }
618
619 public function getName()
620 {
621 return $this->name;
622 }
623 }
624