Google Groups

Re: Best practice to discover all website profiles for given account


J May 11, 2012 8:19 AM
Posted in group: Google Analytics Management API
Rico,

I had the same requirements and I implemented it the same way you described.  I'd also like to know if this is the best way to do this.

BTW - what are batch queries?

J

On Thursday, May 10, 2012 7:10:30 AM UTC-4, RG wrote:
Hi, 

I'm trying to implement a basic setup process where the user of my 
Cocoa app chooses from a drop down list which Google Analytics website 
profile to use based on the Google account they used to sign in. 

What is the best way to discover all website profiles for the user's 
Google account? 


From my understanding I have to run 3 separate queries (using the Objective-C API in this example): 

(1) Query for all management accounts `[GTLQueryAnalytics 
queryForManagementAccountsList]` 

(2) Based on (1), query for all web properties `[GTLQueryAnalytics 
queryForManagementWebpropertiesListWithAccountId:XYZ]` 

(3) Based on (2), query for all website profiles `[GTLQueryAnalytics 
queryForManagementProfilesListWithAccountId:XYZ webPropertyId:ABC]` 

I've implemented 2 + 3 with batch queries. 

Is this the most efficient way to discover all profiles or is there 
another, recommended way? 

Thanks, 
Rico