-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.gManagementApi.php
35 lines (23 loc) · 990 Bytes
/
example.gManagementApi.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require('../gapi.class.php');
require('gManagementApi.class.php');
define('GA_EMAIL', 'myUsername');;
define('GA_PASSWORD', 'mySecretPassword');
$ga = new gManagementApi(GA_EMAIL, GA_PASSWORD);
// Get all the accounts
$ga->requestAccountFeed();
// Get all web properties for all your accounts
$ga->requestAccountFeed('~all');
// Get all web properties for specfically UA-12345-2
$ga->requestAccountFeed('12345');
// To get all the profiles you have access to for web property under account 12345
$ga->requestAccountFeed('12345', '~all');
// To get the profiles for a specific web property UA-12345-2 under account 12345
$ga->requestAccountFeed('12345', 'UA-12345-2');
// To get all the goals for profile 6789 for web property UA-12345-2 under acount 12345
$ga->requestAccountFeed('12345', 'UA-12345-2', '~all');
// To get everything and the kitchen sink
$ga->requestAccountFeed('~all', '~all', '~all');
// To get all advanced segments
$ga->requestAdvancedSegmentFeed();
?>