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
PAPulseRevenueTrackingmodule, which is not exposed as a Swift Package Manager product. The revenue APIs below only exist when that module is linked into your project; otherwisePAAnalytics.enableRevenueTracking()is unavailable and requesting.revenueTrackingviaconfigSet(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-event | Description | Event-specific parameters |
|---|---|---|
revenue_payment_start | User initiates a payment process to buy given IAP | — |
revenue_payment_fail | Payment failed due to some reason | transaction_error (failure reason as a tracking string) |
revenue_payment_deferred | Payment 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_success | Payment is done and verified by App Store | — |
revenue_purchase_restored | Purchases\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_refund | User purchased some “ncp”, “nrs”, “ars”, but it doesn’t satisfy his need and he initiates a refund to get money back | — |
revenue_subscription_cancel | Auto-renewable subscription is canceled (periodical charging is prohibited) | — |
revenue_subscription_grace | Auto-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_renewal | Money is charged for next paid period of subscription | — |
revenue_subscription_expired | Subscription is expired. User doesn’t pay and uses paid functionality. | expiration_reason Possible reasons: “unknown”, “autoRenewDisabled”, “billingError”, “didNotConsentToPriceIncrease”, “productUnavailable” |
revenue_transaction_unknown | Transaction reached an unrecognised state | — |
revenue_transaction_unfinished | StoreKit 2 transaction was not finished (iOS 15+) | — |