Skip to main content

Revenue events

Overview

The Pulse SDK allows monitoring of StoreKit and StoreKit2 transactions and subscription changes triggered by user actions within the application. The SDK can automatically convert these into predefined auto-events. All such events include detailed information derived from the original transactions, while excluding any private financial data. By default, all revenue-related events are disabled to ensure optimal app performance.

Note: Revenue tracking lives in the separate PAPulseRevenueTracking module, which is not exposed as a Swift Package Manager product. The revenue APIs below only exist when that module is linked into your project; otherwise PAAnalytics.enableRevenueTracking() is unavailable and requesting .revenueTracking via configSet(autoEventsConfig:) logs a warning and does nothing.

To enable revenue event tracking, register the tracked product identifiers:

PAAnalytics.configSet(revenueTracking: ["com.example.premium.monthly", "com.example.premium.yearly"])

configSet(revenueTracking:) enables tracking automatically (pass [] to track all products). You can also toggle tracking for already-registered products, or enable it as an auto-event type:

PAAnalytics.enableRevenueTracking()
PAAnalytics.disableRevenueTracking()

let config = PAAutoEventsConfig(autoEventTypes: [.revenueTracking])
PAAnalytics.configSet(autoEventsConfig: config)

Check the current state and enable verbose transaction logging while debugging:

if !PAAnalytics.isRevenueTrackingEnabled {
PAAnalytics.configSet(revenueDebugEnabled: true)
}

All revenue events share the same context parameters: product_provider, product_id, product_type, product_title, product_display_price, product_price, product_price_currency (when available), product_quantity, product_shareable, transaction_date, transaction_original_date, transaction_identifier, transaction_original_identifier, transaction_environment and transaction_purchase_reason. The table below lists only the additional, event-specific parameters.

auto-eventDescriptionEvent-specific parameters
revenue_payment_startUser initiates a payment process to buy given IAP
revenue_payment_failPayment failed due to some reasontransaction_error (failure reason as a tracking string)
revenue_payment_deferredPayment was initiated and put in the queue, because external action (parent approval for children) is required. So payment final status is pending for a while. Later (inside 24 hours slot) one of the events “revenue_payment_fail” or “revenue_payment_success” might be fired anytime.
revenue_payment_successPayment is done and verified by App Store
revenue_purchase_restoredPurchases\subscriptions are restored on a new device or after app reinstall. One event is sent per restored transaction.— (see transaction_original_identifier in the shared parameters)
revenue_payment_refundUser purchased some “ncp”, “nrs”, “ars”, but it doesn’t satisfy his need and he initiates a refund to get money back
revenue_subscription_cancelAuto-renewable subscription is canceled (periodical charging is prohibited)
revenue_subscription_graceAuto-renewable subscription is in grace period due to billing issues. I.e AppStore or GoogleStore tries to retry money charging from the user’s credit card, but without success. The amount of such attempts is restricted.
revenue_subscription_renewalMoney is charged for next paid period of subscription
revenue_subscription_expiredSubscription is expired. User doesn’t pay and uses paid functionality.expiration_reason
Possible reasons: “unknown”, “autoRenewDisabled”, “billingError”, “didNotConsentToPriceIncrease”, “productUnavailable”
revenue_transaction_unknownTransaction reached an unrecognised state
revenue_transaction_unfinishedStoreKit 2 transaction was not finished (iOS 15+)