Docs

Revenue

Track in-app purchases and custom payments with the Grovs iOS 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

  1. Open the Grovs dashboard
  2. Go to your project's Settings
  3. Under Revenue Tracking, click Enable

Revenue data will only be collected while this setting is active.

2. Configure App Store Server Notifications

Required. In-app purchase tracking will not work without this step. Grovs relies on App Store Server Notifications to receive and process transaction data from Apple.

In App Store Connect:

  1. Select your app and go to App Information
  2. Scroll to App Store Server Notifications
  3. Set the Production Server URL to the URL shown in the Grovs dashboard under Developers → iOS Setup → Revenue
  4. Set the Sandbox Server URL to the sandbox URL shown in the same section

If you already handle App Store Server Notifications on your own server, you can forward the events to the Grovs URLs instead.

Logging purchases

The SDK provides two methods depending on whether you use Apple's In-App Purchase system or a custom payment flow.

App Store purchases (StoreKit 2)

For purchases made through Apple's In-App Purchase system, pass the StoreKit 2 transaction ID:

Swift
import StoreKit
 
// After a successful purchase
let result = try await Product.purchase(...)
 
if case .success(let verification) = result,
   case .verified(let transaction) = verification {
 
    Grovs.logInAppPurchase(transactionID: transaction.id) { success in
        if success {
            // Revenue event recorded
            await transaction.finish()
        }
    }
}

The SDK automatically extracts price, currency, and product information from StoreKit. Duplicate transactions are filtered — you can safely call this method without worrying about double-counting.

logInAppPurchase requires iOS 15+ (StoreKit 2).

Custom purchases

For purchases processed through your own server, Stripe, or any non-IAP payment system:

Swift
Grovs.logCustomPurchase(
    type: .buy,
    priceInCents: 999,       // $9.99
    currency: "USD",
    productID: "premium_monthly"
) { success in
    // Revenue event recorded
}

Parameters:

ParameterTypeDescription
typeTransactionType.buy, .cancel, or .refund
priceInCentsIntAmount in cents (e.g. 999 for $9.99)
currencyStringISO 4217 currency code (e.g. "USD", "EUR")
productIDStringYour product identifier
startDateDate?Transaction date. Defaults to now

Tracking cancellations and refunds

Use the .cancel and .refund transaction types to keep revenue data accurate:

Swift
// Log a cancellation
Grovs.logCustomPurchase(
    type: .cancel,
    priceInCents: 999,
    currency: "USD",
    productID: "premium_monthly"
) { success in }
 
// Log a refund
Grovs.logCustomPurchase(
    type: .refund,
    priceInCents: 999,
    currency: "USD",
    productID: "premium_monthly"
) { success in }

For App Store purchases, cancellations and refunds are detected automatically when you configure App Store Server 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.