I'm using Google Analytic's API for javascript.
I'm performing a query for the user's count of a data range, and passing the view ID to the query:
gapi.client.analytics.data.ga.get({
'ids': 'ga:XXXXXXXX',
'start-date': '2014-10-01',
'end-date': '2014-10-15',
'metrics': 'ga:users'
}).execute(function (results) {
if (results.rows && results.rows.length)
console.log(results.rows[0][0]);
});
However, since I'm dealing with the quotas of usage, and I needed to query for multiple views.
Is there a way to request the report for more than one id in the same query?
Something like:
gapi.client.analytics.data.ga.get({
'ids': 'ga:XXXXXXXX, ga:XXXXXXXXX, ga:XXXXXXXXXX', //Which obviously doesn't work
Answer: No there is no way to request more then one profile id
Google Analtyics Reporting API reference
ids=ga:12345
The unique table ID of the form ga:XXXX, where XXXX is the Analytics
view (profile) ID for which the query will retrieve the data.
Even though it is called IDS does not mean that you can send more then one. You can't you can only send one at a time. It is a unique value you are going to have to run your request several times. If you think about it this makes sense as the data you would be getting back would be mixed up between the different profile id's you wouldn't be able to tell which profile the data came from as profile is not a dimension.
Yes, accouding to GA Core Reporting API documentation you're allowed to query only one View ID at a time (in the same query).
However, you might decide to opt for some programming language scripts and iterate through multiple View IDs when you run the query. That is what I've done using the R language and a package named RGoogleAnalytics (which allows connecting to GA API). Running a for loop allowed me to retrieve data from multiple View IDs and store it in the same dataset. Here is a post explaining how to do this in R: http://goo.gl/ppnj8Y
Let me know if this can be of any help.