Revenue
Track in-app purchases and custom payments with the Grovs Android SDK
Revenue tracking lets you attribute purchases to links and campaigns, monitor metrics like ARPU and LTV, and view breakdowns by product and platform — all from the Grovs dashboard.
Revenue tracking is currently in beta. There may be minor discrepancies in currency conversion rates while processing is being fine-tuned.
Setup
1. Enable revenue tracking in the dashboard
- Open the Grovs dashboard
- Go to your project's Settings
- Under Revenue Tracking, click Enable
Revenue data will only be collected while this setting is active.
2. Configure Google Play Real-Time Notifications
Required. In-app purchase tracking will not work without this step. Grovs relies on Google Play Real-Time Developer Notifications to receive and process transaction data.
Option A: Automatic setup (recommended)
The Grovs dashboard provides a script that automates the entire Google Cloud Platform configuration — including service account creation, API enablement, and Pub/Sub setup.
- In the Grovs dashboard, go to Developers → Android Setup → Revenue
- Click Download Script to download
grovs_android_gcloud_setup.sh - Open Google Cloud Shell
- Upload the script: click the ⋮ (three dots) menu in the Cloud Shell toolbar → Upload → select the downloaded file
- Run the script:
Bash
chmod +x grovs_android_gcloud_setup.sh ./grovs_android_gcloud_setup.sh - The script will show your available Google Cloud projects — select one or create a new one
- When the script completes, it outputs the service account email and a
play-api-key.jsonfile — you'll need both in the steps below
The script is safe to re-run. Existing resources are imported and updated, not duplicated.
Option B: Manual setup
If you prefer to configure Google Cloud yourself:
- In the Google Cloud Console, create a Pub/Sub topic for your app
- Create a service account with access to the Android Publisher API
- Download the service account's JSON key file
3. Complete the connection
These steps apply regardless of whether you used the automatic script or manual setup.
Upload the key to Grovs
- In the Grovs dashboard under Developers → Android Setup → Revenue, upload the JSON key file (
play-api-key.jsonfrom the script, or the key you created manually)
Invite the service account to Google Play Console
- In the Google Play Console, go to Users and permissions
- Click Invite new users and enter the service account email shown in the Grovs dashboard (or printed by the setup script)
- Grant the following permissions (all three are required for revenue tracking):
- View app information and download bulk reports (read-only)
- View financial data, orders, and cancellation survey responses
- Manage orders and subscriptions
- Click Invite user and confirm
Permissions can take up to 24 hours to propagate. Revenue data may not appear immediately after setup.
Enable Real-Time Developer Notifications
- In the Google Play Console, go to your app → Monetization setup → Google Play Billing → Real-time developer notifications
- Paste the Notifications endpoint URL shown in the Grovs dashboard
- Enable the following notification types:
- Subscription notifications — required for tracking recurring purchases
- Voided purchase notifications — required for tracking refunds and chargebacks
- One-time product notifications — required if your app sells one-time (non-subscription) products
- Send a test notification to verify the connection
Already receiving Google Play notifications? If you handle notifications on your own server, you can forward the events to the Grovs endpoint URL instead of pointing Google Play directly to Grovs.
Logging purchases
The SDK provides two methods depending on whether you use Google Play Billing or a custom payment flow.
Google Play purchases
For purchases made through Google Play Billing, pass the purchase object's originalJson:
// After a successful purchase via Google Play Billing Library
billingClient.launchBillingFlow(activity, billingFlowParams)
// In your PurchasesUpdatedListener
override fun onPurchasesUpdated(billingResult: BillingResult, purchases: List<Purchase>?) {
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK && purchases != null) {
for (purchase in purchases) {
Grovs.logInAppPurchase(purchase.originalJson)
}
}
}The SDK automatically extracts the product ID, purchase token, price, and currency from the purchase JSON. Duplicate transactions are filtered — you can safely call this method without worrying about double-counting.
Custom purchases
For purchases processed through your own server, Stripe, or any non-Play Store payment system:
Grovs.logCustomPurchase(
type = PaymentEventType.BUY,
priceInCents = 999, // $9.99
currency = "USD",
productId = "premium_monthly"
)Parameters:
| Parameter | Type | Description |
|---|---|---|
type | PaymentEventType | BUY, CANCELLATION, or REFUND |
priceInCents | Int | Amount in cents (e.g. 999 for $9.99) |
currency | String | ISO 4217 currency code (e.g. "USD", "EUR") |
productId | String | Your product identifier |
startDate | InstantCompat? | Transaction date. Defaults to now |
Tracking cancellations and refunds
Use the CANCELLATION and REFUND event types to keep revenue data accurate:
// Log a cancellation
Grovs.logCustomPurchase(
type = PaymentEventType.CANCELLATION,
priceInCents = 999,
currency = "USD",
productId = "premium_monthly"
)
// Log a refund
Grovs.logCustomPurchase(
type = PaymentEventType.REFUND,
priceInCents = 999,
currency = "USD",
productId = "premium_monthly"
)For Google Play purchases, cancellations and refunds are detected automatically when you configure Google Play Real-Time Notifications.
Dashboard metrics
Once revenue tracking is enabled and events are flowing in, the dashboard shows:
- Total Revenue — aggregate revenue with currency conversion
- ARPU — average revenue per user
- ARPPU — average revenue per paying user
- LTV — lifetime value per product
- Units Sold — total purchases
- First-time vs. Repeat Purchases — new vs. returning customers
- Cancellations — cancelled transactions
All metrics can be filtered by date range, platform, and product.