{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["sub-heading","admonition"]},"type":"markdown"},"seo":{"title":"Analytics","description":"Transform your commerce with PXP's unified platform—seamless payments, real-time insights, and global growth in one powerful integration.","lang":"en-UK","siteUrl":"https://developer.pxp.io","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"analytics","__idx":0},"children":["Analytics"]},{"$$mdtype":"Tag","name":"SubHeading","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get actionable, trackable data to support decisions and performance on iOS."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overview","__idx":1},"children":["Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK emits structured analytics events when important actions or states occur (lifecycle, interactions, tokenisation, 3DS, authorisation, errors, and more). You handle them in one place: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckoutConfig.analyticsEvent"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Analytics help you:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["See the full journey from field interaction through tokenisation, 3DS (when enabled), and authorisation."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Optimise conversion by correlating abandonment, validation-style signals, and errors with funnel steps."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Feed data into your analytics or CRM tools (subject to privacy and consent)."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This is checkout-level telemetry. Component config callbacks (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onChange"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmitError"]},", etc.) are separate — see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/checkout/components/ios/card/events"},"children":["Events"]},". Validation-related signals appear as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ComponentErrorAnalyticsEvent"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ComponentInteractionAnalyticsEvent"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"consume-an-event","__idx":2},"children":["Consume an event"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Pass a closure when you build ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CheckoutConfig"]},". The SDK calls it from checkout and component code (including ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["submitAsync()"]},"). Keep the closure fast; move network I/O or heavy work to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Task.detached"]}," or your own queue so you don't block the main thread."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import PXPCheckoutSDK\n\nlet checkoutConfig = CheckoutConfig(\n    environment: .test,\n    session: sessionData,\n    transactionData: transactionData,\n    merchantShopperId: \"shopper-id\",\n    ownerType: \"MerchantGroup\",\n    ownerId: \"your-owner-id\",\n    analyticsEvent: { event in\n        switch event {\n        case let e as ComponentErrorAnalyticsEvent:\n            print(e.errorCode ?? \"\", e.errorMessage)\n        case let e as ComponentInteractionAnalyticsEvent:\n            print(e.componentType, e.interactionType)\n        case let e as PaymentLifecycleAnalyticsEvent:\n            print(e.eventName, e.transactionId)\n        case let e as RetryablePaymentLifecycleAnalyticsEvent:\n            print(e.eventName, e.isRetry)\n        default:\n            print(event.eventName)\n        }\n\n        Task.detached(priority: .utility) {\n            await forwardToYourPipeline(event)\n        }\n    }\n)\n\nlet pxpCheckout = try PxpCheckout.initialize(config: checkoutConfig)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["switch"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["as?"]}," on concrete subclasses so you can read typed properties. Tokenisation milestones (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PreTokenizationAnalyticsEvent"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PostTokenizationAnalyticsEvent"]},") extend ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentLifecycleAnalyticsEvent"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]},"). 3DS and authorisation milestones extend ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RetryablePaymentLifecycleAnalyticsEvent"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isRetry"]},"). Those two bases are sibling subclasses of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseAnalyticsEvent"]},", not parent and child."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Apple Pay and PayPal define additional event types in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PXPCheckoutSDK"]},"; the table focuses on card-related names."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"supported-events","__idx":3},"children":["Supported events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each row is the string in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["event.eventName"]},". Every event also includes ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["eventName"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sessionId"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["timestamp"]}," from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseAnalyticsEvent"]},"."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Event name"},"children":["Event name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Structure"},"children":["Structure"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DeviceType"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["deviceType"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CustomerClick"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["elementId"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CardBrandType"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardBrand"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CardDeletion"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["elementId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardStatus"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardBrand"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ChangePreselectedCardClick"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentId"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ComponentAbandonment"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ComponentError"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorCode"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorMessage"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentId"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ComponentInteraction"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["interactionType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ComponentLifecycleEvent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["eventType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentId"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CVVFillTime"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startTimeStamp"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["endTimeStamp"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["duration"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["EditCardClick"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["editedFields"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["elementId"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ErrorMessageShown"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["messageContent"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["elementId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["OneclickPaymentCompletionTime"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startTimeStamp"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["endTimeStamp"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["duration"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["OneclickPaymentConfirmed"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["—"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentAbandonment"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PayButtonClick"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardBrand"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentId"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PreInitiateAuthentication"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isRetry"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PostInitiateAuthentication"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isRetry"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PreAuthentication"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isRetry"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PostAuthentication"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isRetry"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PreTokenization"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PostTokenization"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PreAuthorisation"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isRetry"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PostAuthorisation"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isRetry"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SecurityCheck"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkType"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Property names match the Swift types (for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TokenListFillCVVTimerAnalyticsEvent"]}," uses ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startTimeStamp"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["endTimeStamp"]},")."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"event-data","__idx":4},"children":["Event data"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardBrand"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Card brand (for example scheme name)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardStatus"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Card state (for example expired)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cardType"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Funding or token classification as reported by the SDK."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["checkType"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Security or callback identifier for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SecurityCheck"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Component instance identifier."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["componentType"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Logical type (for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["NewCard"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ClickOnce"]},")."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["duration"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Elapsed time in milliseconds where timing events apply."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["editedFields"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Fields edited in token list flows."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["elementId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["UI element identifier."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["endTimeStamp"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Interval end (Unix-style stamp where used)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorCode"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Machine-readable error code when present."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorMessage"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Human-readable error text."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["eventName"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Event discriminator string."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["eventType"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Lifecycle subtype (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mount"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["unmount"]},", etc.)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["interactionType"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["focus"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["blur"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paste"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["change"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSubmit"]},", …"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["isRetry"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Whether the step is part of a retry path (retryable lifecycle events)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["messageContent"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Text shown to the shopper (trim before logging externally)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sessionId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Checkout session ID."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startTimeStamp"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Interval start (Unix-style stamp where used)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["timestamp"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["When the event was created."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Transaction identifier when allocated."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"json-and-forwarding","__idx":5},"children":["JSON and forwarding"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BaseAnalyticsEvent"]}," subclasses conform to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Encodable"]},". Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["JSONEncoder"]}," with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["dateEncodingStrategy = .iso8601"]}," and encode the runtime subclass if you need full payloads for an API."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"func encodeEvent(_ event: BaseAnalyticsEvent) -> Data? {\n    let encoder = JSONEncoder()\n    encoder.dateEncodingStrategy = .iso8601\n    // Cast to each concrete type you persist — encoding as BaseAnalyticsEvent\n    // does not include subclass-specific keys.\n    switch event {\n    case let e as ComponentErrorAnalyticsEvent: return try? encoder.encode(e)\n    case let e as PaymentLifecycleAnalyticsEvent: return try? encoder.encode(e)\n    case let e as RetryablePaymentLifecycleAnalyticsEvent: return try? encoder.encode(e)\n    default: return nil\n    }\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For Firebase Analytics, names and parameter lengths are limited — see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://firebase.google.com/docs/analytics/ios/events"},"children":["Firebase event limits"]},". Truncate ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorMessage"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["messageContent"]}," (for example to 100 characters) and normalise ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["eventName"]}," to allowed characters before ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Analytics.logEvent"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"practices-and-privacy","__idx":6},"children":["Practices and privacy"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Filter noisy events in production if you only care about errors and payment milestones."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Never let a logging failure break checkout — wrap third-party SDK calls and swallow or degrade gracefully."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Obtain consent where required; avoid exporting data that could identify users when combined with other sources."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Don't log PAN/CVC; review ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["messageContent"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["errorMessage"]}," before they leave the device."]}]}]},"headings":[{"value":"Analytics","id":"analytics","depth":1},{"value":"Overview","id":"overview","depth":2},{"value":"Consume an event","id":"consume-an-event","depth":2},{"value":"Supported events","id":"supported-events","depth":2},{"value":"Event data","id":"event-data","depth":2},{"value":"JSON and forwarding","id":"json-and-forwarding","depth":2},{"value":"Practices and privacy","id":"practices-and-privacy","depth":2}],"frontmatter":{"seo":{"title":"Analytics"}},"lastModified":"2026-05-18T10:04:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/checkout/components/ios/card/analytics","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}