It's possible to track in-app purchase information and send info to Appodeal servers for analytics. It allows to group users by the fact of purchasing in-apps. This will help you to adjust the ads for such users or simply turn it off, if needed. To make this setting work correctly, please submit the purchase info via the Appodeal SDK.
Step 1. Validate In-app Purchases
To track in-app purchase, Appodeal SDK will need info about purchases provided by the Google Play Billing Library.
Add the following dependency into your module-level build.gradle:
Get your Purchase and SkuDetails objects from the Google Play Billing Library using the guide. Get a price and currency from SkuDetails.
Create and validate in-app purchase using the method below:
Please make sure if you have created in-app product in Google Play Console → Monetize section to use:
- InAppPurchase.Type.InApp for purchase type,
- InAppPurchase.Type.Subs for subscription.
|purchaseType||Purchase type. Must be InAppPurchase.Type.InApp or InAppPurchase.Type.Subs||Adjust/AppsFlyer|
|publicKey||Public key from Google Developer Console.||AppsFlyer|
|signature||Transaction signature (returned from Google API when the purchase is completed).||Adjust/AppsFlyer|
|purchaseData||Product purchased in JSON format (returned from Google API when the purchase is completed).||AppsFlyer|
|purchaseToken||Product purchased token (returned from Google API when the purchase is completed).||Adjust|
|purchaseTimestamp||Product purchased timestamp (returned from Google API when the purchase is completed).||Adjust|
|developerPayload||Product purchased developer payload (returned from Google API when the purchase is completed).||Adjust|
|orderId||Product purchased unique order id for the transaction (returned from Google API when the purchase is completed).||Adjust|
|sku||Stock keeping unit id.||Adjust|
|price||In-app event revenue.||Adjust/AppsFlyer/Appodeal|
|currency||In-app event currency.||Adjust/AppsFlyer/Appodeal|
|additionalParameters||Additional parameters of the in-app event.|
In-App purchase validation runs by FIFO queue in a single thread.
If you are using your own Adjust account you need to complete Step 2 from our Event Tracking guide and create some required events on Adjust side.
Step 2. Generate Json File In Google Cloud
- Login to Google Cloud with your credentials.
Select Google Play Console Developer project on the top left corner as shown below.
Please make sure to select Google Play Console Developer project at this step instead of your exact app project. Google Play Console only allows to link Google Play Console Developer cloud projects (later in step 3).
- Select Credentials → Create Credentials → select Service Account.
- Select Viewer as a role for Service Account and press Done.
- Go to your service account and press keys → Add key → choose JSON → and send us the JSON file via email email@example.com or a live chat.
Step 3. Add Required Permissions In Google Play Console
- Go to the Google Play Console and log in.
Go to Google Play Console->Manage developer accounts->Choose developer account-> Setup->API Access and choose your Google Play Console Developer project from step 2 where you have created your Service Account.
If you are not able to see Google Play Console Developer project in the list then please update the webpage.
If the issue persists, make sure that your Google Play developer account(email) is the owner of the Google Cloud project. You can read more here.
At the bottom there will be a list of service accounts that are available in this Google Cloud project. Select the one from which the JSON was sent.
Press Refresh if you are not able to see your Service Account.
- Press View Play Console permissions. In the App Permissions section select the necessary applications where in-app events will be used.
- Go to Account Permissions section and select all Financial Data permissions:
- View financial data
- Manage Orders, subscriptions
Step 4. Contact Us
After all completed steps, contact our support team via email firstname.lastname@example.org or a live chat with the following information :
- Service account JSON file.
- Purchases implementation logic in your app (when and where you call validate method and validate purchases).
- Send us the purchase testing access through the Google Developer console to email email@example.com.
- Your apk in a zip for testing.