Google Accounts Management API Script Public Copy
 Share
The version of the browser you are using is no longer supported. Please upgrade to a supported browser.Dismiss

 
Comment only
 
 
ABCDEFGHI
1
Google Analytics Management API v1.0
2
Last Updated: 22nd August 2013
3
Provided as is. May contain bugs and quirks
4
Author:Carmen Mardiros (carmen@mardiros.net). Comments and questions welcome
5
Website:ClearClues.com
6
Twitterhttps://twitter.com/carmenmardiros
7
Linkedin:http://www.linkedin.com/in/carmenmardiros
8
9
10
Description
11
This set of scripts uses the Management API to retrieve accounts, web properties, profiles, goals and segments from Google Analytics that your Google Login has access to. See the kind of data the scripts retrieve below.
12
13
Benefits
14
Quickly view all profile settings for particular account/web properties.
15
Compare settings for different profiles, or drill down to a particular one.
16
Get all PAGE and EVENT based goals for audit or verification with all their settings, steps, expression, values etc
17
Get all segments with segment ID, name, regex.
18
Quickly identify the id for any account, web property or profile.
19
Access a wealth of data which you can then reuse with the Google Analytics Core Reporting API.
20
21
Initial Authorisation and Set Up
22
23
Step 1. Create a copy of this spreadsheet first. Use your own copy to run the scripts. Do not use THIS spreadsheet to pull data or your data will be visible to anyone else who has edit rights to this spreadsheet.
24
25
Step 2. Authorise Google Apps Scripts
26
Go to GA Management Scripts menu in your spreadsheet and run 'Get GA Accounts'
27
You will see a prompt that says "This app needs authorization to run". Click OK and follow on-screen instructions to authorise.
28
29
Step 3. Enable Google Analytics API from the Google API Console
30
Go to Tools>Script Editor. This takes you to the Script window
31
Go to Resources>Use Google APIs. Make sure the Google Analytics API is switched to ON (it should turn green)
32
Click on "Google APIs Console" link at the bottom of the prompt. This takes you to All Services page on Google APIs. Switch Analytics API to ON (it should turn green)
33
Return to Script window and click OK.
34
35
36
37
Usage Instructions
38
39
Get All GA Accounts and Properties
40
41
Step 1. Go to GA Management Scripts menu in your spreadsheet and run 'Get GA Accounts'
42
This retrieves all the accounts and properties your current Google Login has access to.
43
44
45
Get All Profiles
46
47
Step 1. Go to 'GA Management Scripts' menu in your spreadsheet and run 'Get GA Profiles (all)'.
48
This retrieves all the profiles for all the GA accounts and web properties your current Google Login has access to.
49
NOTE: It may take some considerable time if you have access to many accounts. The script is designed to run for 4 minutes at a time, then "sleep" for 1 minute to overcome Google Apps Scripts execution limits. Please be patient and wait for the "Finished successfully" message.
50
51
Get Selected Profiles
52
53
Step 1. Run 'Get GA Accounts' script first from the 'GA Management Scripts' menu if you haven't already done so.
54
Step 2. Go to 'gaAccounts' sheet and tick 'x' in column A for the accounts/web properties you wish to retrieve profile data for.
55
Step 3. Run 'Get GA Profiles (selected properties)' script first from the 'GA Management Scripts' menu.
56
57
58
Get Goals
59
60
Step 1. Run 'Get GA Accounts' script first from the 'GA Management Scripts' menu if you haven't already done so.
61
Step 2. Go to 'gaAccounts' sheet and tick 'x' in column A for the accounts/web properties you wish to retrieve goal data for.
62
Step 3. Run 'Get GA Goals (selected properties)' script first from the 'GA Management Scripts' menu.
63
64
Get Segments
65
66
Step 1. Run 'Get GA Segments' script first from the 'GA Management Scripts' menu.
67
This retrieves all the segments your current Google Login has access to (segments are not profile-specific).
68
69
70
Any problems? Find my on Twitter @carmenmardiros
71
72
73
Data Fields Each Script Retrieves
74
75
Get GA AccountsAccount Id
76
Account Name
77
Property Name
78
Property URL
79
Property Id
80
81
82
83
84
85
86
87
Get GA ProfilesAccount Id
88
Account Name
89
Property Name
90
Property URL
91
Property Id
92
Profile Id
93
Profile Type
94
Profile Name
95
Profile URL
96
Profile Created Time
97
Profile Modified Time
98
Currency
99
Timezone
100
Default Page
Loading...
Main menu