Skip to content

Analytics

Get actionable, trackable data instantly to drive better decisions and performance.

Overview

Analytics events are structured data objects that are automatically triggered when significant actions or states occur within Drop-in. Use them to monitor the payment journey.

Analytics events allow you to:

  • Gain transparency with native transaction tracking in PXP reports.
  • Optimise conversion rates and reduce drop-offs, thanks to actionable insights.
  • Feed real-time data into your analytics and CRM systems.

Consume an event

Set analyticsEvent on CheckoutDropInConfig when you call CheckoutDropIn.initialize(). The SDK invokes the callback whenever an analytics event is emitted during the checkout session (after create(), user interaction, and payment flow)—not only during initialize().

DeviceType is emitted from initialize() itself (via triggerAnalyticsEvents()). Component and Aeropay journey events also require create() and Content().

For example (with Aeropay enabled):

import android.util.Log
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import com.pxp.checkout.analytics.BaseAnalyticsEvent
import com.pxp.checkout.checkoutdropin.CheckoutDropIn
import com.pxp.checkout.checkoutdropin.types.CheckoutDropInConfig
import com.pxp.checkout.exceptions.BaseSdkException
import com.pxp.checkout.models.CardIntentType
import com.pxp.checkout.models.DropInAeropayIntentType
import com.pxp.checkout.models.DropInPayPalIntentType
import com.pxp.checkout.models.DropInTransactionData
import com.pxp.checkout.models.DropInTransactionIntentData
import com.pxp.checkout.models.EntryType
import com.pxp.checkout.models.Environment
import com.pxp.checkout.models.SessionConfig
import com.pxp.checkout.services.models.transaction.Shopper
import java.time.Instant
import java.util.UUID

// sessionConfig from Sessions API (see Quickstart)
val sessionConfig: SessionConfig = fetchSessionFromBackend()

val checkoutDropIn = CheckoutDropIn.initialize(
    context = context,
    config = CheckoutDropInConfig(
        environment = Environment.TEST,
        session = sessionConfig,
        ownerType = "MerchantGroup",
        ownerId = "MERCHANT-1",
        transactionData = DropInTransactionData(
            amount = 99.99,
            currency = "USD",
            entryType = EntryType.Ecom,
            intent = DropInTransactionIntentData(
                card = CardIntentType.Authorisation,
                paypalDropInIntent = DropInPayPalIntentType.Purchase,
                aeropayDropInIntent = DropInAeropayIntentType.Authorisation
            ),
            merchant = "MERCHANT-1",
            merchantTransactionId = UUID.randomUUID().toString(),
            merchantTransactionDate = { Instant.now().toString() }
        ),
        onGetShopper = {
            Shopper(id = "shopper-001")
        },
        analyticsEvent = { event: BaseAnalyticsEvent ->
            Log.d("Analytics", "Event: ${event.eventName} ts=${event.timestamp}")

            // Send to your analytics platform (illustrative)
            sendToAnalyticsPlatform(event)
        },
        onSuccess = { result ->
            verifyPaymentOnBackend(result)
        },
        onError = { paymentMethod, error ->
            Log.e(
                "Checkout",
                "Payment failed [${paymentMethod?.value}]: ${error.errorCode}: ${error.message}"
            )
        }
    )
)

LaunchedEffect(checkoutDropIn) {
    checkoutDropIn.create()
}

checkoutDropIn.Content(modifier = Modifier.fillMaxWidth())

Aeropay requires aeropayDropInIntent, currency = "USD", entryType = EntryType.Ecom, and session allowedFundingTypes.payByBanks.aeropay. See Aeropay for full setup. Without aeropayDropInIntent, Aeropay journey analytics such as AerosyncLaunched and PreAuthorisation don't run.

Event structure

BaseAnalyticsEvent defines the following base properties:

Property Type Description
eventName
String
The Android Drop-in event name (e.g., "ComponentInteraction", "PreAuthorisation", "AerosyncLaunched").
sessionId
String
The session ID for the current checkout session.
timestamp
Long
When the event occurred, as milliseconds since epoch (default: System.currentTimeMillis()). Convert to ISO 8601 in your handler if needed. Gson serialises timestamp as a JSON number.

There's no generic properties map on the base type. Event-specific fields live on concrete subclasses (e.g., device type, component type, or transaction ID). Prefer when (event) on those types, or serialize with AnalyticsGsonProvider.toJson(event), rather than assuming a shared property bag.

Common analytics events

Drop-in emits Android eventName values from the checkout analytics package. Representative events:

Event name Description
DeviceTypeFired during CheckoutDropIn.initialize() via triggerAnalyticsEvents(), not during create().
ComponentLifecycleEventComponent mount or unmount (eventType: Mount or Unmount). Fired after create() / panel mount.
ComponentInteractionUser interactions (clicks, field focus).
ComponentErrorSDK or component errors.
CustomerClickPay button or launcher clicks.
PreAuthorisation or PostAuthorisationPayment lifecycle (card, Aeropay, Google Pay, and other methods that authorise through this path). Same eventName across methods — use componentType on the concrete event type (for example "aeropay") before attributing to a method.
PreAuthentication or PostAuthentication3DS authentication steps.
3ds_authentication_* or 3ds_challenge_*3DS challenge flow events.
ErrorMessageShownInline validation or error messages shown to the shopper.
authentication_failureAuthentication failures.
GooglePayButtonClickGoogle Pay button interaction.

Wallet- or method-specific names also apply (e.g., button-click events).

Aeropay Drop-in analytics

When Aeropay is enabled and eligible, the same analyticsEvent handler receives Aeropay-specific and shared events during the popup flow (consumer data, OTP, Aerosync).

Journey map

The following table maps the Aeropay journey to typical eventName values:

StageTypical eventName values
Drop-in initialize()DeviceType
After create() / panel visibleComponentLifecycleEvent (Mount), further ComponentInteraction
Shopper opens AeropayCustomerClick or component interaction events
Consumer data, OTP, validationComponentInteraction, ComponentError, ErrorMessageShown
Bank linking (Aerosync)AerosyncLaunched, then AerosyncCompleted or AerosyncFailed
AuthorisationPreAuthorisation, then PostAuthorisation on success

Aeropay-specific event names

eventNameWhen
AerosyncLaunchedAerosync widget opens.
AerosyncCompletedAerosync completes successfully.
AerosyncFailedAerosync ends in failure.
PreAuthorisationAuthorisation starts. Shared across methods; Aeropay emits componentType = "aeropay" on the concrete event type.
PostAuthorisationAuthorisation completes. Shared across methods; branch on componentType (or the concrete analytics type) before attributing to Aeropay.

Example — attribute shared lifecycle names to Aeropay only when the component type matches:

import com.pxp.checkout.analytics.common.PostAuthorisationAnalyticsEvent
import com.pxp.checkout.analytics.common.PreAuthorisationAnalyticsEvent

analyticsEvent = { event ->
    when (event) {
        is PreAuthorisationAnalyticsEvent ->
            if (event.componentType == "aeropay") track("aeropay_pre_auth")
        is PostAuthorisationAnalyticsEvent ->
            if (event.componentType == "aeropay") track("aeropay_post_auth")
        else -> when (event.eventName) {
            "AerosyncLaunched" -> track("aeropay_aerosync_started")
            "AerosyncCompleted" -> track("aeropay_bank_linked")
            "AerosyncFailed" -> track("aeropay_aerosync_failed")
            "ComponentError" -> track("checkout_component_error", event)
            else -> { }
        }
    }
}

Shared events (ComponentInteraction, ComponentError, ComponentLifecycleEvent, ErrorMessageShown) also fire during consumer data and OTP steps.