Blog Article

Understanding Google Workspace Marketplace Installs

Published: October 8, 2022

Now that you have published your Addon to the Google Workspace Marketplace you are ready to have people outside your domain install it! Congrats!!

Now how can you see your users?

The Usage tab in the Google Marketplace SDK will show the number of installs at a high level.

Individual Installs info from Marketplace SDK Usage tab

Domain Installs info from Marketplace SDK Usage tab

Seat Installs info from Marketplace SDK Usage tab

Those graphs are great for seeing raw install numbers but not great for anything else.

So how can you get info on when a user installs your Addon? The Google Workspace Marketplace API console: Marketplace API

Developer info: https://developers.google.com/workspace/marketplace/overview

The licenseNotification.list endpoint is where you will find the information you are looking for: https://developers.google.com/workspace/marketplace/example-calls-marketplace-api

There are 2 types of installs for the Marketplace:

  • Domain. Installed for the entire domain by the domain's Google Admin. Note: The total number of users on the domain will be reflected in your installed user info.
  • Individual. Usually a gmail.com user but can also be on a Workspace domain if the domain's Google Admin allow users to install from the Marketplace.

If you are using Apps Script, you can just use the function below. I found the best results by using a timestamp and maxResults parameters. The notification.customerId is an email address for individual installs ('user@example.com') and a domain address for domain installs ('example.com').

Note: I understand I could use a switch function instead of the if statements ;)

 function getMarketplaceInfo(applicationId,timestamp,maxResults) {
 
  var marketplaceURLToFetch = "https://appsmarket.googleapis.com/appsmarket/v2/licenseNotification/"+applicationId+"?alt=json&timestamp="+timestamp+"&max-results="+maxResults;
  
  var options = {
   method: "GET",
   muteHttpExceptions: true,
   headers: { Authorization: 'Bearer ' + ScriptApp.getOAuthToken() }
  }
  var res = UrlFetchApp.fetch(marketplaceURLToFetch, options)
  res = JSON.parse(res.getContentText());
  var notifications = res.notifications;

  for (var i in notifications){
    var customerId = notifications[i].customerId;

    var installationDate = new Date(new Date().setTime(notifications[i].timestamp));
    var installationType = (customerId.indexOf('@') == -1) ? "DOMAIN" : "INDIVIDUAL";
   
  
    if(notifications[i].deletes){
      //they uninstalled
    }
    else if(notifications[i].provisions){
      //they installed now can do something like send them the Welcome email
     
    }
    else if(notifications[i].reassignments){
          //just the other option, we also get this with deletions so no need to record them
    }
   
  }
}