Skip to content

Analytics

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

Overview

Analytics events are structured data objects that get automatically triggered when significant actions or states occur within the drop-in. These allow you to monitor every aspect of 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

Analytics events should be consumed in the analyticsEvent callback when initialising Drop-in.

For example:

import com.pxp.checkout.checkoutdropin.CheckoutDropIn
import com.pxp.checkout.checkoutdropin.types.CheckoutDropInConfig
import com.pxp.checkout.analytics.BaseAnalyticsEvent

val checkoutDropIn = CheckoutDropIn.initialize(
    context = context,
    config = CheckoutDropInConfig(
        environment = Environment.TEST,
        session = sessionData,
        ownerType = "MerchantGroup",
        ownerId = "MERCHANT-1",
        transactionData = DropInTransactionData(
            amount = 99.99,
            currency = "USD",
            entryType = EntryType.Ecom,
            intent = DropInTransactionIntentData(
                card = IntentType.Authorisation,
                paypalDropInIntent = DropInPayPalIntentType.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}")
            
            // Send to your analytics platform
            sendToAnalyticsPlatform(event)
        },
        onSuccess = { result ->
            verifyPaymentOnBackend(result)
        },
        onError = { error ->
            Log.e("Checkout", "Payment failed: ${error.message}")
        }
    )
)

Event structure

Each analytics event contains the following base properties:

Property Description
eventName
String
The name of the analytics event (e.g., "payment_method_selected", "payment_submitted").
sessionId
String
The session ID for the current checkout session.
timestamp
String
When the event occurred, in ISO 8601 format.
properties
Map<String, Any>?
Additional event-specific properties (varies by event type).

Common analytics events

The drop-in automatically triggers the following events during the payment journey:

Event name Description
drop_in_initializedFired when the drop-in is successfully initialised.
drop_in_renderedFired when the drop-in UI is rendered on screen.
payment_method_displayedFired when a payment method is displayed to the customer.
payment_method_selectedFired when the customer selects a payment method.
payment_details_enteredFired when the customer completes entering payment details.
payment_submittedFired when the customer submits the payment.
payment_processingFired when payment processing begins.
payment_succeededFired when the payment completes successfully.
payment_failedFired when the payment fails.
payment_cancelledFired when the customer cancels the payment.
three_d_secure_startedFired when 3D Secure authentication begins.
three_d_secure_completedFired when 3D Secure authentication completes.
validation_errorFired when field validation fails.
sdk_errorFired when an SDK error occurs.