---
id: metricevents
title: Metric Events
hide_title: true
description: "Metrics to create funnel insights in Walley Checkout"
---

import Ingress from "../../../src/components/ingress/ingress.react";

<Ingress title="Metric Events [Draft]">
  Use Metric Events to create insights using your favorite analytics tool like
  Google Analytics
</Ingress>

:::info Events can fire more than once
These events are intended to create analytic insights and make it possible to track the customer journey in Walley Checkout.
Events might be triggered more than once for a session, and you will have to cater for this in your analytics tool
:::

## Examples

```javascript
/* Javascript event listeners using DOM */
document.addEventListener("walleyCheckoutMetric", (event) => {
  console.log("WALLEY CHECKOUT METRIC", event.detail);

  // Example payload. Note this is an object and you need to parse this according to event payload in the table below
  const payload = event.detail.payload;

  // See event types in table below
  const type = payload.type;

  // Send to your analytics tool, example with Google Analytics
  gtag("event", type, {
    app_name: "MyWebSite",
    value: payload,
  });
});
```

## Example event object

```javascript
{
    // public token for the session emitting the event
    "token": "public-SE-000000000000000000000000000000000000000000000000",
    "payload": {
        // This is the type described below
        "type": "PaymentOptionSelected",

        // Payload according to event type
        "paymentOption": {
            "paymentMethodName": "PartPayment",
            "paymentOptionId": 6
        }
    }
}
```

## Event definitions

The following describes the payload object of each emitted event

### Initialized

The Checkout was successfully Initialized, occurs right before rendering

```
"payload": {
  "type": "Initialized"
}
```

### InView

The Checkout has been rendered and its call-to-action (CTA) is within the viewport of the user

```
"payload": {
  "type": "InView"
}
```

### CustomerIdentified

The customer has been successfully identified by the user (not by prefill or preset by merchant)

```
"payload": {
  "type": "CustomerIdentified"
}
```

### DeliveryAddressChanged

The delivery address has been updated. Occurs automatically when a customer is identified, or when a user changes it manually

```
"payload": {
  "type": "DeliveryAddressChanged"
}
```

### ShippingMethodSelected

A shipping method (or a sub-choice of a shipping method) has been selected by the user. Occurs only when shipping is used in the checkout.

```
"payload": {
  "type": "ShippingMethodSelected"
}
```

### PaymentCategorySelected

A payment category has been selected by the user

```
"payload": {
  "type": "PaymentCategorySelected",
  "category": "postDelivery"
}
```

### PaymentMethodSelected

A payment method has been selected by the user, or default value set when payment category is selected

```
"payload": {
  "type": "PaymentMethodSelected",
  "paymentMethod": "DirectInvoice"
}
```

### PaymentOptionSelected

Occurs when a sub-choice of a payment method has been selected, for example duration of payment method

```
"payload": {
  "type": "PaymentOptionSelected",
  "paymentOption": {
      "paymentMethodName": "PartPayment",
      "paymentOptionId": 6
  }
}
```

### CommittedToPurchase

The user has clicked the Complete purchase CTA button

```
"payload": {
  "type": "CommittedToPurchase"
}
```

### SCARequested

The user has been presented with a dialogue stating that Strong Customer Authentication is required for this purchase

```
"payload": {
  "type": "SCARequested"
}
```

### SCAStarted

The user is either redirected to SCA when in NO, FI, DK. When using BankID in SE this is not triggered since it is done on device or by scanning QR code.

```
"payload": {
  "type": "SCAStarted"
}
```

### SCACanceled

The user cancelled manually, or the SCA session timed out.

```
"payload": {
  "type": "SCACanceled"
}
```

### KALPRequested

The user has been presented with a dialogue stating that KALP (Household calculation) is required to continue.

```
"payload": {
  "type": "KALPRequested"
}
```

### KALPCanceled

The KALP was cancelled by the user

```
"payload": {
  "type": "KALPCanceled"
}
```

### KALPSubmitted

The KALP was successfully submitted

```
"payload": {
  "type": "KALPSubmitted"
}
```

### PurchaseFailed

The purchase failed. This could be due to several reasons including credit check denied or fraud rules. We cannot reveal the reason to this due to privacy and secrecy.

```
"payload": {
  "type": "PurchaseFailed"
}
```

### PurchaseCompleted

The purchase was successfully completed.

```
"payload": {
  "type": "PurchaseCompleted"
}
```

### CustomerFeedback

The user gave feedback about the purchase.

```
"payload": {
   "type": "CustomerFeedback",
    "customerSatisfied": true
}
```

### WidgetPartPaymentLinkClicked

The user clicked the link in the part payment widget

```
"payload": {
   "type": "WidgetPartPaymentLinkClicked",
    "amount": 5000
}
```
