# Ecommerce

To track an event using the ecommerce package, you can use the corresponding method on the tracker instance. For example:

## Example

{% tabs %}
{% tab title="Android" %}

```kotlin
val properties = EcommerceCheckoutUpdatedProperties(
    checkoutId = checkoutId
)
bird.tracker.ecommerce.checkoutUpdated(properties)
```

{% endtab %}

{% tab title="Swift" %}

```swift
let properties = EcommerceCheckoutUpdatedProperties(
    checkoutId: checkoutId
)
bird.tracker.ecommerce.checkoutUpdated(properties)
```

{% endtab %}

{% tab title="Web" %}

```javascript
const properties: EcommerceCheckoutUpdatedProperties = {
    checkout_id: checkout_id
};
Bird.tracker.ecommerce.checkoutUpdated(properties, event_opts);
```

{% endtab %}
{% endtabs %}

## Methods

### checkoutUpdated()

{% tabs %}
{% tab title="Android" %}

```kotlin
val properties = EcommerceCheckoutUpdatedProperties(
    checkoutId = checkoutId
)
bird.tracker.ecommerce.checkoutUpdated(properties)
```

{% endtab %}

{% tab title="Swift" %}

```swift
let properties = EcommerceCheckoutUpdatedProperties(
    checkoutId: checkoutId
)
bird.tracker.ecommerce.checkoutUpdated(properties)
```

{% endtab %}

{% tab title="Web" %}

```javascript
const properties: EcommerceCheckoutUpdatedProperties = {
    checkout_id: checkout_id
};
Bird.tracker.ecommerce.checkoutUpdated(properties, event_opts);
```

{% endtab %}
{% endtabs %}

#### EcommerceCheckoutUpdatedProperties

| Property             | Type                       |
| -------------------- | -------------------------- |
| checkout\_id?        | String                     |
| checkout\_url?       | String                     |
| currency?            | String                     |
| customer\_email?     | String                     |
| customer\_phone?     | String                     |
| items?               | Array\<Map\<String, Any?>> |
| product\_categories? | Array                      |
| product\_ids?        | Array                      |
| product\_names?      | Array                      |
| product\_skus?       | Array                      |
| total\_price?        | Number                     |

### checkoutAbandoned()

{% tabs %}
{% tab title="Android" %}

```kotlin
val properties = EcommerceCheckoutAbandonedProperties(
    billingAddress = billingAddress
)
bird.tracker.ecommerce.checkoutAbandoned(properties)
```

{% endtab %}

{% tab title="Swift" %}

```swift
let properties = EcommerceCheckoutAbandonedProperties(
    billingAddress: billingAddress
)
bird.tracker.ecommerce.checkoutAbandoned(properties)
```

{% endtab %}

{% tab title="Web" %}

```javascript
const properties: EcommerceCheckoutAbandonedProperties = {
    billing_address: billing_address
};
Bird.tracker.ecommerce.checkoutAbandoned(properties, event_opts);
```

{% endtab %}
{% endtabs %}

#### EcommerceCheckoutAbandonedProperties

| Property             | Type                       |
| -------------------- | -------------------------- |
| billing\_address?    | Map\<String, Any?>         |
| checkout\_id?        | String                     |
| checkout\_url?       | String                     |
| currency?            | String                     |
| customer\_email?     | String                     |
| customer\_phone?     | String                     |
| items?               | Array\<Map\<String, Any?>> |
| product\_categories? | Array                      |
| product\_ids?        | Array                      |
| product\_names?      | Array                      |
| product\_skus?       | Array                      |
| total\_price?        | Number                     |

### orderConfirmed()

{% tabs %}
{% tab title="Android" %}

```kotlin
val properties = EcommerceOrderConfirmedProperties(
    billingAddress = billingAddress
)
bird.tracker.ecommerce.orderConfirmed(properties)
```

{% endtab %}

{% tab title="Swift" %}

```swift
let properties = EcommerceOrderConfirmedProperties(
    billingAddress: billingAddress
)
bird.tracker.ecommerce.orderConfirmed(properties)
```

{% endtab %}

{% tab title="Web" %}

```javascript
const properties: EcommerceOrderConfirmedProperties = {
    billing_address: billing_address
};
Bird.tracker.ecommerce.orderConfirmed(properties, event_opts);
```

{% endtab %}
{% endtabs %}

#### EcommerceOrderConfirmedProperties

| Property             | Type                       |
| -------------------- | -------------------------- |
| billing\_address?    | Map\<String, Any?>         |
| currency?            | String                     |
| customer\_email?     | String                     |
| customer\_phone?     | String                     |
| financial\_status?   | String                     |
| items?               | Array\<Map\<String, Any?>> |
| order\_created\_at?  | String                     |
| order\_id?           | String                     |
| order\_number?       | String                     |
| order\_updated\_at?  | String                     |
| order\_url?          | String                     |
| product\_categories? | Array                      |
| product\_ids?        | Array                      |
| product\_names?      | Array                      |
| product\_skus?       | Array                      |
| shipping\_address?   | Map\<String, Any?>         |
| total\_price?        | Number                     |

### orderCanceled()

{% tabs %}
{% tab title="Android" %}

```kotlin
val properties = EcommerceOrderCanceledProperties(
    billingAddress = billingAddress
)
bird.tracker.ecommerce.orderCanceled(properties)
```

{% endtab %}

{% tab title="Swift" %}

```swift
let properties = EcommerceOrderCanceledProperties(
    billingAddress: billingAddress
)
bird.tracker.ecommerce.orderCanceled(properties)
```

{% endtab %}

{% tab title="Web" %}

```javascript
const properties: EcommerceOrderCanceledProperties = {
    billing_address: billing_address
};
Bird.tracker.ecommerce.orderCanceled(properties, event_opts);
```

{% endtab %}
{% endtabs %}

#### EcommerceOrderCanceledProperties

| Property             | Type                       |
| -------------------- | -------------------------- |
| billing\_address?    | Map\<String, Any?>         |
| currency?            | String                     |
| customer\_email?     | String                     |
| customer\_phone?     | String                     |
| financial\_status?   | String                     |
| items?               | Array\<Map\<String, Any?>> |
| order\_canceled\_at? | String                     |
| order\_created\_at?  | String                     |
| order\_id?           | String                     |
| order\_number?       | String                     |
| order\_updated\_at?  | String                     |
| order\_url?          | String                     |
| product\_categories? | Array                      |
| product\_ids?        | Array                      |
| product\_names?      | Array                      |
| product\_skus?       | Array                      |
| reason?              | String                     |
| shipping\_address?   | Map\<String, Any?>         |
| total\_price?        | Number                     |

### orderFulfilled()

{% tabs %}
{% tab title="Android" %}

```kotlin
val properties = EcommerceOrderFulfilledProperties(
    billingAddress = billingAddress
)
bird.tracker.ecommerce.orderFulfilled(properties)
```

{% endtab %}

{% tab title="Swift" %}

```swift
let properties = EcommerceOrderFulfilledProperties(
    billingAddress: billingAddress
)
bird.tracker.ecommerce.orderFulfilled(properties)
```

{% endtab %}

{% tab title="Web" %}

```javascript
const properties: EcommerceOrderFulfilledProperties = {
    billing_address: billing_address
};
Bird.tracker.ecommerce.orderFulfilled(properties, event_opts);
```

{% endtab %}
{% endtabs %}

#### EcommerceOrderFulfilledProperties

| Property              | Type                       |
| --------------------- | -------------------------- |
| billing\_address?     | Map\<String, Any?>         |
| currency?             | String                     |
| customer\_email?      | String                     |
| customer\_phone?      | String                     |
| financial\_status?    | String                     |
| fulfillment\_status?  | String                     |
| fulfillments?         | Array\<Map\<String, Any?>> |
| items?                | Array\<Map\<String, Any?>> |
| order\_closed\_at?    | String                     |
| order\_created\_at?   | String                     |
| order\_id?            | String                     |
| order\_number?        | String                     |
| order\_processed\_at? | String                     |
| order\_updated\_at?   | String                     |
| order\_url?           | String                     |
| product\_categories?  | Array                      |
| product\_ids?         | Array                      |
| product\_names?       | Array                      |
| product\_skus?        | Array                      |
| shipping\_address?    | Map\<String, Any?>         |
| total\_price?         | Number                     |

### cartViewed()

{% tabs %}
{% tab title="Android" %}

```kotlin
val properties = EcommerceCartViewedProperties(
    cartId = cartId
)
bird.tracker.ecommerce.cartViewed(properties)
```

{% endtab %}

{% tab title="Swift" %}

```swift
let properties = EcommerceCartViewedProperties(
    cartId: cartId
)
bird.tracker.ecommerce.cartViewed(properties)
```

{% endtab %}

{% tab title="Web" %}

```javascript
const properties: EcommerceCartViewedProperties = {
    cart_id: cart_id
};
Bird.tracker.ecommerce.cartViewed(properties, event_opts);
```

{% endtab %}
{% endtabs %}

#### EcommerceCartViewedProperties

| Property         | Type                       |
| ---------------- | -------------------------- |
| cart\_id?        | String                     |
| checkout\_url?   | String                     |
| currency?        | String                     |
| customer\_email? | String                     |
| customer\_phone? | String                     |
| items?           | Array\<Map\<String, Any?>> |
| product\_ids?    | Array                      |
| product\_names?  | Array                      |
| product\_skus?   | Array                      |
| total\_price?    | Number                     |
| total\_quantity? | Number                     |

### cartUpdated()

{% tabs %}
{% tab title="Android" %}

```kotlin
val properties = EcommerceCartUpdatedProperties(
    cartId = cartId
)
bird.tracker.ecommerce.cartUpdated(properties)
```

{% endtab %}

{% tab title="Swift" %}

```swift
let properties = EcommerceCartUpdatedProperties(
    cartId: cartId
)
bird.tracker.ecommerce.cartUpdated(properties)
```

{% endtab %}

{% tab title="Web" %}

```javascript
const properties: EcommerceCartUpdatedProperties = {
    cart_id: cart_id
};
Bird.tracker.ecommerce.cartUpdated(properties, event_opts);
```

{% endtab %}
{% endtabs %}

#### EcommerceCartUpdatedProperties

| Property         | Type                       |
| ---------------- | -------------------------- |
| cart\_id?        | String                     |
| checkout\_url?   | String                     |
| currency?        | String                     |
| customer\_email? | String                     |
| customer\_phone? | String                     |
| items?           | Array\<Map\<String, Any?>> |
| product\_ids?    | Array                      |
| product\_names?  | Array                      |
| product\_skus?   | Array                      |
| total\_price?    | Number                     |
| total\_quantity? | Number                     |

### productViewed()

{% tabs %}
{% tab title="Android" %}

```kotlin
val properties = EcommerceProductViewedProperties(
    price = price
)
bird.tracker.ecommerce.productViewed(properties)
```

{% endtab %}

{% tab title="Swift" %}

```swift
let properties = EcommerceProductViewedProperties(
    price: price
)
bird.tracker.ecommerce.productViewed(properties)
```

{% endtab %}

{% tab title="Web" %}

```javascript
const properties: EcommerceProductViewedProperties = {
    price: price
};
Bird.tracker.ecommerce.productViewed(properties, event_opts);
```

{% endtab %}
{% endtabs %}

#### EcommerceProductViewedProperties

| Property             | Type   |
| -------------------- | ------ |
| price?               | Number |
| product\_id?         | Any    |
| product\_image\_url? | String |
| product\_name?       | Any    |
| product\_sku?        | Any    |
| product\_url?        | String |

### collectionViewed()

{% tabs %}
{% tab title="Android" %}

```kotlin
val properties = EcommerceCollectionViewedProperties(
    collectionId = collectionId
)
bird.tracker.ecommerce.collectionViewed(properties)
```

{% endtab %}

{% tab title="Swift" %}

```swift
let properties = EcommerceCollectionViewedProperties(
    collectionId: collectionId
)
bird.tracker.ecommerce.collectionViewed(properties)
```

{% endtab %}

{% tab title="Web" %}

```javascript
const properties: EcommerceCollectionViewedProperties = {
    collection_id: collection_id
};
Bird.tracker.ecommerce.collectionViewed(properties, event_opts);
```

{% endtab %}
{% endtabs %}

#### EcommerceCollectionViewedProperties

| Property          | Type |
| ----------------- | ---- |
| collection\_id?   | Any  |
| collection\_name? | Any  |
