# Google Play Revenue Tracking

In the **Revenue Tracking** section under **Settings**, you can now setup Google
Play Revenue Tracking.

<img src="__img0" />

> **Warning**

Google has made this really hard, so if you don't exactly follow the steps
below, you might not get it working.



> **Warning**

Once configured, it can take up to 36 hours for the keys to start working.



1\. Enable Required APIs [#1-enable-required-apis]

* Enable: [Google Play Android Developer
  API](https://console.cloud.google.com/apis/library/androidpublisher.googleapis.com)
* Enable: [Cloud Pub/Sub
  API](https://console.cloud.google.com/apis/library/pubsub.googleapis.com)

If these are enabled, you'll see a blue "Manage" button next to the "Try this
API" button and a green API Enabled check.

2\. Create a Service Account [#2-create-a-service-account]

Create a new service account [#create-a-new-service-account]

* Visit [Service
  Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts) and
  create a new user.

* 1. Create service account
     You can specify anything here.

<img src="__img1" />

* 2. Permissions

  * Add the "Pub/Sub Admin" role
  * Add the "Monitoring Viewer" role

<img src="__img2" />

* 3. Principals with access

  Skip this step.

Download the service account credentials [#download-the-service-account-credentials]

1. Click on the newly created service account
2. Go to the "Keys" tab
3. Click "Add key"
4. Select "Create new key"
5. Select "JSON"
6. Click "Create"
7. Upload that key file to Superwall under "Google Play Private Key"

<img src="__img3" />

<img src="__img4" />

<img src="__img5" />

3\. Add Service Account to Google Play Console [#3-add-service-account-to-google-play-console]

1. Visit [Google Play Console](https://play.google.com/console/u/0/signup)
2. Select "Users and Permissions"
3. Click "Invite new users"
4. Paste in the email address of the service account you created. You'll find this under the "Details" tab of your service account.
5. Select "Account Permissions"
6. Add the following permissions:

* "View app information and download bulk reports"
* "View financial data, orders, and cancellation survey responses"
* "Manage orders and subscriptions"

7. Click "Invite"

4\. Setup Pub/Sub Topic [#4-setup-pubsub-topic]

1. Go to your app within the Google Play Console
2. Select "Monetize with Play"
3. Select "Monetization setup"
4. Under "Google Play Billing", check "Enable real-time notifications"
5. Copy the "Topic Name" from Superwall and paste it into the "Topic name" field in the Google Play Console.
   * If you do not see this field, ensure the service account from [Step 3](#3-add-service-account-to-google-play-console) has been correctly added to the Play Console
6. Under "Notification content", select "Subscriptions, voided purchases, and all one-time products"
7. Click "Save"