1

I'm using the Google Analytics API via Google App Scripts to measure retention of users for an app in a specific country.

For example: X number of users in the USA download and open the app on 2nd March 2016. How many of those users came back to the app and opened it in the time period of 3 March - 9 March 2016?

I have been extracting this information using Google App Scripts, however I'm concerned because when I filter by country, the numbers retrieved via the script are significantly different than what I can see on Google Analytics web console.

Can someone please confirm that the method for getting this information is correct?

To get the number of users who installed on 2nd March 2016 in the USA, I use the following script and then get the New User count for that day:

var optArgs = {
    'dimensions': 'ga:userType',
    'filters':'ga:country==United States'
  };

  var results = Analytics.Data.Ga.get(
      tableId,                    
     '03-02-2016',                  
     '03-02-2016',                    
     'ga:users', 
     optArgs);

  if (results.getRows()) {
    return results.getRows()[0];   

To get the second number -- the number of users in the USA who had installed on the 2 March 2016 and had re-opened the app between 3 March - 9 March 2016 -- I use the following code and look at the Returning Users count:

  var optArgs = {
    'dimensions': 'ga:userType',
    'filters':'ga:country==United States',
    'segment':'users::condition::dateOfSession<>03-02-2016_03-02-2016;ga:sessionCount==1'
  };

  var results = Analytics.Data.Ga.get(
      tableId,                   
      '03-03-2016',                 
      '03-09-2016',                    
      'ga:users', 
      optArgs);
  if (results) {
      return results.getRows(); 

Thanks in advance.

DaImTo
  • 72,534
  • 21
  • 122
  • 346
Tess
  • 11
  • 1

0 Answers0