Configure automatic in-app purchase tracking¶
GetSocial SDK supports tracking purchases users make in your application. The gathered data is shown in Revenue Analytics section.
To be able to track purchases, SDK requires some configuration steps.
Android¶
To track in-app purchases automatically on Android, GetSocial can get data from the Google Play Billing Library or Google Play Billing Service depending on what you are using for in-app purchases.
You have to configure only one approach. Therefore it is crucial to determine what are you using.
Determine what to configure¶
To help you to determine which approach you are using and have to configure:
- Enable GetSocial debug logs and start your application.
- Open Logcat → set filtering level to
DEBUG
. - Search your logs. They will contain one of the following lines:
Using Billing Library to track purchases
→ go to Configure Google Play Billing LibraryUsing Billing Service to track purchases
→ go to Configure Google Play Billing Service
Option A: Configure Google Play Billing Library¶
- Login to Google Play Developer Console.
- Choose the application you registered on GetSocial Dashboard.
- Open Development tools → Services & APIs.
- Copy the Base64-encoded RSA public key in Licensing & in-app billing.
- Open GetSocial Dashboard and go to App Settings → IAP Tracking.
- Enable Google Play, choose Using Google Play Billing Library option and paste the copied license key into the input field.
- Press Save to persist your changes.
Option B: Configure Google Play Billing Service¶
- Go to the Google Play Developer Console.
- Select Settings → API access.
- Click the Create New Project button.
-
Click the Create Service Account button in the Service Accounts section.
-
In the info box click on the Google API Console link.
-
Now click on Create Service Account button.
-
Enter Service account details then click on Create button.
-
On Service account permissions (optional) page add Android Management User role from Android Management group, then click on Next button.
-
On Grant users access to this service account (optional) page click on Create key button.
-
Select
JSON
format and press Create. This will trigger the private key to be downloaded to your computer.
-
Close it using the Close button.
-
To finish API access configuration, go back to API access page and click on Grant access next to the service account email.
-
Choose a role, like View financial reports and click on Add user button.
-
Open GetSocial Dashboard and go to App Settings → IAP Tracking.
- Enable Google Play, choose Using Google Play Billing Service option and upload the downloaded
JSON
file. - Press Save to persist your changes.
- Take in mind that it could take up to 48 hours for Google Account permissions to propagate.
Testing¶
Launch your application and make a purchase (test purchase is also fine). On Android, purchases are tracked on each application launch, so after you finished the purchase process, you need to stop and restart your application.
Revenue analytics will start appearing in the GetSocial Dashboard in the Revenue analytics section. Take in mind that it could take up to 1 hour for the analytics to get updated.
iOS¶
Configuration¶
Purchase tracking on iOS requires your App-Specific Shared Secret
code.
- Login to iTunes Connect.
- Select My Apps.
- Choose the application you registered on GetSocial Dashboard.
- Select Features tab.
- Choose on In-app Purchases on the left side.
- Click on App-Specific Shared Secret on the right side.
- Copy the Shared secret code.
- Open GetSocial Dashboard and go to App Settings → IAP Tracking
- Enable Apple App Store and paste the copied shared secret into the input field.
- Press Save to persist your changes.
Testing¶
Launch your application and make a purchase (test purchase is also fine). After you finished the purchase process, go to GetSocial Dashboard, you should see your new purchase in Revenue analytics section.