How do I implement Opensend SDK for e-commerce events tracking?

Opensend's event tracking can be used for a variety of use cases, including the triggering of event-based retargeting flows such as product, cart or check-out abandonment

Initialization

The Opensend SDK is designed to capture various e-commerce events, providing valuable insights into customer behavior and interactions. This document outlines the technical details of the SDK's implementation, including event descriptions, data properties, and usage examples.

Ideally, the main snippet code should be placed within the <head> tag so it can be loaded as soon as possible on each page. This ensures that the SDK is initialized promptly and captures relevant events accurately across the e-commerce platform.
The SDK is loaded asynchronously, ensuring it does not impact the loading performance of your website. All events will be handled after the page has finished loading, guaranteeing optimal performance and accuracy without affecting the user experience.

Before you begin:

Before integrating the Opensend SDK into your website, please ensure you have the necessary information available, by following these steps:
Note: Before you can begin utilizing the Opensend SDK, it is essential to ensure that you are on the v2 version of Opensend Pixel. If you have not yet migrated to Opensend Pixel v2, please refer to this guide to complete the migration process.

  1. Follow this guide to get Opensend pixel
  2. Gather the following information:
    1. INTEGRATION-TYPE
    2. INTEGRATION-ID
<script type="text/javascript">
  !(function (s) {
    var o = s.createElement("script"),
      u = s.getElementsByTagName("script")[0];
    o.src = "https://cdn.aggle.net/oir/oir.min.js";
    o.async = !0;
    o.setAttribute("oirtyp", "REPLACE WITH INTEGRATION-TYPE");
    o.setAttribute("oirid", "REPLACE WITH INTEGRATION-ID");
    u.parentNode.insertBefore(o, u);
  })(document);
</script>

Global configurations

Global Custom Data

By using the following syntax, you can define global custom data that will be appended to all events tracked by the Opensend SDK after initialization. This feature enables you to include common properties across multiple events without duplicating them in each individual event call.

It's recommended to set Global Custom Data as soon as the initialization snippet code is loaded. Alternatively, to ensure Global Custom Data is set before other events are called, you can also place the Global Custom Data code before the initialization code snippet.

_oirtrk.push(['set', key, value])

You can hard-code the value or dynamically pull it from another object using JavaScript.

Example:

<script type="text/javascript">
  function getSessionId() {
    // Your code here
  }
</script>

<script type="text/javascript">
  !(function (e) {
    e._oirtrk = e._oirtrk || [];
    e._oirtrk.push(["set", "puid", "12345"]); // Hard-coded value
    e._oirtrk.push(["set", "sessionId", getSessionId()]); // Dynamically pulled from another function
  })(window);
</script>

Best practice:

<script type="text/javascript">
  function getSessionId() {
    // Your code here
  }
</script>

<script type="text/javascript">
  !(function (e) {
    e._oirtrk = e._oirtrk || [];
    e._oirtrk.push(["set", "puid", "12345"]); // Hard-coded value
    e._oirtrk.push(["set", "sessionId", getSessionId()]); // Dynamically pulled from another function
  })(window);
</script>

<script type="text/javascript">
  !(function (s) {
    var o = s.createElement("script"),
      u = s.getElementsByTagName("script")[0];
    o.src = "https://cdn.aggle.net/oir/oir.min.js";
    o.async = !0;
    o.setAttribute("oirtyp", "REPLACE WITH INTEGRATION-TYPE");
    o.setAttribute("oirid", "REPLACE WITH INTEGRATION-ID");
    u.parentNode.insertBefore(o, u);
  })(document);
</script>

User Data Integration

This section encompasses the management and integration of user-related data within the Opensend SDK, providing flexibility and customization options to tailor the tracking experience to your specific needs.

Identify Method

The identify method allows you to set properties on an individual user. This method accepts a dictionary of properties, including standard fields such as email address, first name, last name, and any custom properties you choose to include. When identifying a user, it's recommended to include as many relevant properties as possible to enrich the user profile and improve tracking accuracy.

_oirtrk.push(['identify', data]);

Example:

<script type="text/javascript">
  !(function (e) {
    var data = {
event: "identify",
  user_properties: {
email: "abc_test@gmail.com",
phone_number: "+123456789",
user_id: "12345",
address: {
first_name: "aaa",
last_name: "bbbb",
street: "273 woodruff ave",
city: "new york",
state: "ny",
zip: "10001",
country: "us"
}
  }
    };
    (e._oirtrk = e._oirtrk || []).push(["identify", data]);
  })(window);
</script>

User Activity Tracking

This section covers the tracking of various user activities within the Opensend SDK, including both predefined and custom events. By leveraging the tracking capabilities provided by the SDK, clients can gain insights into user behavior and interactions on their e-commerce platform.

On Site event

The OnSite event marks the start of the tracking journey within the Opensend SDK. It is recommended to place the On Site event tracking code within the body of the main page to ensure it is triggered accurately upon user visits.

Once an OnSite event is triggered, the user is identified and added to the main profile pool through the main integration. This enables comprehensive tracking of user interactions across the entire website.

You can also include custom data in your tracking requests. If you don't have any custom data to include, simply pass an empty object {} to the data parameter in your tracking request.

_oirtrk.push(['event', data]);

Example:

<script type="text/javascript">
  !(function (e) {
    var data = {
    event: "on_site",
    payload: {}
    }
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Page Viewed

This event occurs when a user views a specific page on your e-commerce site.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘page_view’ for this event type.

payload

object

Required

Event attributes.

payload.page_url

string

Required

The URL of the page being viewed.

payload.page_title

string

Optional

The title of the page being viewed.

payload.referrer

string

Optional

The URL of the referring page.

payload.session_id

string

Optional

An identifier for the session.

payload.browser_info

object

Optional

Information about the user's browser.

payload.device_info

object

Optional

Information about the user's device.

payload.custom_attribute

object

Optional

Custom attribute for additional data

Example:

<script type="text/javascript">
  !(function (e) {
    var data = {
    event: "page_view",
    payload:
    {
      page_url: "https://example.com/page",
      page_title: "Example Page",
      referrer: "https://referrer.com",
      user_id: "123456",
      session_id: "abcdef123456",
      timestamp: "2024-04-12T08:30:00Z",
      viewport_size: "1920x1080",
      browser_info: {
        browser_name: "Chrome",
        browser_version: "90.0.4430.212",
        browser_language: "en-US",
      },
      device_info: {
        device_type: "Desktop",
        device_os: "Windows 10",
        device_model: "HP Pavilion",
      },
      custom_attributes: {
        custom_attribute1: "value1",
        custom_attribute2: "value2",
      }
}
    };
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Custom event

In addition to tracking predefined events, you have the flexibility to create your own events to track specific user interactions or behaviors that are important to your business.

Later on, you can capture these custom events using your delivery integration. It's important to define your event set carefully, as you'll be able to segment your events using the event name. This segmentation capability allows you to organize and analyze your data more effectively, leading to better insights and decision-making.

_oirtrk.push(['event', data]);

Example:

Let's say you have an e-commerce website selling various products. You want to track when users add items to their wishlist because it's an important indicator of interest in a product.

To do this, you can create a custom event called "added-to-wishlist" and include relevant data such as product name, brand, and color. Whenever a user adds an item to their wishlist, you trigger the "added-to-wishlist" event with the associated data.

<script type="text/javascript">
  !(function (e) {
    var data = {
      event: "custom_event_name",
    payload:
    {
        attribute_1: "attribute_1", 
        attribute_2: "attribute_1",
        custom_attribute_1:
        {
        attribute_1: "custom_attribute_1"
    attribute_2: "custom_attribute_2"
}
}
};
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

E-commerce Event Tracking

This section outlines various e-commerce events that can be tracked using the Opensend SDK. These events provide valuable insights into user behavior and interactions on the ecommerce platform.

Cart Viewed

This event occurs when a user views their shopping cart.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘view_cart’ for this event type.

ecommerce

object

Required

Event attributes.

ecommerce.cart_id

string

Optional

Unique identifier of the shopping cart.

ecommerce.cart_url

string

Optional

URL of the shopping cart.

ecommerce.currency

string

Optional

Currency of price, discount. 

ecommerce.value

float

Required

Sum of (price * quantity) for all items.

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.item_id

string

Required

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.item_category

string

Optional

Category of the product.

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_name

string

Required

Name of the product.

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

ecommerce.items.0.custom_attribute

object

Optional

Custom attribute for additional data. 

Example:

<script type="text/javascript">
  !(function (e) {
    // Define the data object with properties for the Cart Viewed event
    var data = {
      event: "view_cart",
      ecommerce: {
currency: "USD",
value: 30.03,
cart_id: "CART_1",
cart_url: "https://example.com/cart/123"
items:
[
{
item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
custom_attribute: {}
  }
]
    };
    // Push the Cart Viewed event to the tracking array
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Product Added To Cart

This event occurs when a user adds a product to their shopping cart.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘add_to_cart’ for this event type.

ecommerce

object

Required

Event attribute.

ecommerce.cart_id

string

Optional

Unique identifier of the shopping cart.

ecommerce.cart_url

string

Optional

URL of the Cart.

ecommerce.currency

string

Optional

Currency of price, discount.

ecommerce.value

float

Optional

Sum of (price * quantity) for all items.

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.item_id

string

Required

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.item_category

string

Optional

Category of the product.

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

ecommerce.items.0.custom_attribute

object

Optional

Custom attribute for additional data.

Example:

<script type="text/javascript">
  !(function (e) {
    var data = {
      event: "add_to_cart",
      ecommerce: {
  currency: "USD",
  value: 30.03,
  cart_id: "CART_1",
      cart_url: "https://example.com/cart/123",
       items: [
  {
item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
custom_attribute: {}
  }
]
    };
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Product Removed From Cart

This event occurs when a user removes a product from their shopping cart.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘remove_from_cart’ for this event type.

ecommerce

object

Required

Event attribute.

ecommerce..cart_id

string

Optional

Unique identifier of the shopping cart.

ecommerce.cart_url

string

Optional

URL of Shopping Cart.

ecommerce.currency

string

Optional

Currency of price, discount.

ecommerce.value

float

Optional

Sum of (price * quantity) for all items.

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.item_id

string

Optional

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.item_category

string

Optional

Category of the product.

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

ecommerce.items.0.custom_attribute

object

Optional

Custom attribute for additional data.

Example:

<script type="text/javascript">
  !(function (e) {
    var data = {
      event: "remove_from_cart",
      ecommerce: {
currency: "USD",
value: 30.03,
cart_id: "CART_1",
cart_url: "https://example.com/cart/123",
    items: [
    {
item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
custom_attribute: {}
    }
]
    };
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Checkout Started

This event occurs when a user starts the checkout process by entering their payment and shipping information.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘begin_checkout’ for this event type.

ecommerce

object

Required

Event attributes.

ecommerce.checkout_id

string

Optional

Unique identifier of the shopping cart.

ecommerce.checkout_url

string

Optional

URL of the shopping cart checkout page.

ecommerce.total_items

int

Optional

Total number of items in the cart.

ecommerce.value

float

Required

Total price of all items in the cart.

ecommerce.revenue

float

Optional

Total revenue from the checkout.

ecommerce.shipping

float

Optional

Shipping cost for the checkout.

ecommerce.tax

float

Optional

Tax amount for the checkout.

ecommerce.discount

float

Optional

Discount applied to the checkout.

ecommerce.coupon

string

Optional

Coupon applied to the checkout.

ecommerce.currency

string

Optional

Currency used for the checkout.

ecommerce.cart_id

string

Optional

Unique identifier of the shopping cart.

ecommerce.cart_url

string

Optional

URL of the shopping cart.

       

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.item_id

string

Required

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.item_category

string

Optional

Category of the product.

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

ecommerce.items.0.custom_attribute

object

Optional

Custom attribute for additional data.

Example:

<script type="text/javascript">
  !(function (e) {
    // Define the data object with properties for the Checkout Started event
    var data = {
  event: "begin_checkout",
  ecommerce: {
checkout_id: "CHECKOUT_1",
checkout_url: "https://example.com/checkout/123",
total_items: 2,
value: 41.04,
revenue: 10.04,
shipping: 0.01,
tax: 0.01,
discount: 0.01,
currency: "USD",
coupon: "SUMMER_FUN_2",
cart_id: "CART_1",
cart_url: "https://example.com/cart/123"
    items: [
    {
      item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
custom_attribute: {}
    },
    {
    item_variant: "red",
item_id: "SKU_123456",
item_category: "Apparel",
item_category2: "Adult2,
item_category3: "Shirts2,
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 11.01,
quantity: 1,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/1234”,
image_url: "https://example.com/product/1234/image",
custom_attribute: {}
    }
]
  }
};
    // Push the Checkout Started event to the tracking array
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Add Shipping Info

This event occurs when a user proceeds to the next step in the checkout process and adds shipping information.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘add_shipping_info’ for this event type.

ecommerce

object

Required

Event attributes.

ecommerce.value

float

Required

Total amount of the order.

ecommerce.shipping_tiers

string

Required

Specify the user’s delivery option, such as "Ground", "Air", or "Next-day".

ecommerce.shipping

float

Optional

Shipping cost for the order.

ecommerce.coupon

string

Optional

coupon applied.

ecommerce.currency

string

Optional

Currency used for the order.

ecommerce.cart_id

string

Optional

Unique identifier of the shopping cart.

ecommerce.cart_url

string

Optional

URL of the shopping cart.

       

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.item_id

string

Optional

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.item_category

string

Optional

Category of the product.

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

ecommerce.items.0.custom_attribute

object

Optional

Custom attribute for additional data.

shipping

object

Optional

Shipping information for the order.

shipping.first_name

string

Optional

First name of the shipping contact.

shipping.last_name

string

Optional

Last name of the shipping contact.

shipping.email

string

Optional

Email of the shipping contact.

shipping.company

string

Optional

Company name of the shipping contact.

shipping.address_1

string

Optional

Address line 1 of the shipping contact.

shipping.address_2

string

Optional

Address line 2 of the shipping contact.

shipping.city

string

Optional

City of the shipping contact.

shipping.country

string

Optional

Country of the shipping contact.

shipping.country_code

string

Optional

Country code of the shipping contact.

shipping.postal_code

string

Optional

Postal code of the shipping contact.

shipping.phone

string

Optional

Phone number of the shipping contact.

Example:

<script type="text/javascript">
  !(function (e) {
    var data = {
  event: "add_shipping_info",
  ecommerce: {
order_id: "T_12345",
total_items: 1,
value: 30.03,
shipping: 0.01,
currency: "USD",
coupon: "SUMMER_SALE",
shipping_tier: "Air",
cart_id: "CART_1",
cart_url: "https://example.com/cart/123"
    items: [
    {
      item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
custom_attribute: {}
    }
]
  },
shipping: {
 first_name: "Max",
last_name: "Min",
email: "example@example.com",
company: "COMPANY A",
address_1: "EXAMPLE ADDRESS 1",
address_2: "EXAMPLE ADDRESS 2",
city: "CITY A",
country: "ABC DE",
country_code: "ABC",
postal_code: "123456",
phone: "+01 2345678",
  },
};


    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Add Payment Info

This event occurs when a user submits their payment information.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘add_payment_info’ for this event type.

ecommerce

object

Required

Event attributes.

ecommerce.value

float

Required

Total amount of the order.

ecommerce.shipping_tiers

string

Required

Specify the user’s delivery option, such as "Ground", "Air", or "Next-day".

ecommerce.shipping

float

Optional

Shipping cost for the order.

ecommerce.coupon

string

Optional

coupon applied.

ecommerce.currency

string

Optional

Currency used for the order.

ecommerce.cart_id

string

Optional

Unique identifier of the shopping cart.

ecommerce.cart_url

string

Optional

URL of the shopping cart.

       

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.item_id

string

Required

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.item_category

string

Optional

Category of the product.

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

ecommerce.items.0.custom_attribute

object

Optional

Custom attribute for additional data.

billing

object

Optional

Shipping information for the order.

billing.first_name

string

Optional

First name of the shipping contact.

billing.last_name

string

Optional

Last name of the shipping contact.

billing.email

string

Optional

Email of the shipping contact.

billing.company

string

Optional

Company name of the shipping contact.

billing.address_1

string

Optional

Address line 1 of the shipping contact.

billing.address_2

string

Optional

Address line 2 of the shipping contact.

billing.city

string

Optional

City of the shipping contact.

billing.country

string

Optional

Country of the shipping contact.

billing.country_code

string

Optional

Country code of the shipping contact.

billing.postal_code

string

Optional

Postal code of the shipping contact.

billing.phone

string

Optional

Phone number of the shipping contact.

Example

<script type="text/javascript">
  !(function (e) {
    var data = {
  event: "add_payment_info",
  ecommerce: {
total_items: 1,
value: 30.03,
shipping: 0.01,
currency: "USD",
coupon: "SUMMER_SALE",
payment_type: "Credit Card",
cart_id: "CART_1",
cart_url: "https://example.com/cart/123",
    items: [
    {
item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
custom_attribute: {}
    }
]
  },
billing: {
 first_name: "Max",
last_name: "Min",
email: "example@example.com",
company: "COMPANY A",
address_1: "EXAMPLE ADDRESS 1",
address_2: "EXAMPLE ADDRESS 2",
city: "CITY A",
country: "ABC DE",
country_code: "ABC",
postal_code: "123456",
phone: "+01 2345678",
  },
};


    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Ordered Placed

This event occurs when a user places an order on your ecommerce platform.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘purchase’ for this event type.

ecommerce

object

Required

Event attributes.

ecommerce.order_id

string

Required

Unique identifier of the order.

ecommerce.total_items

int

Optional

Total item of the order.

ecommerce.value

float

Required

Total amount of the order.

ecommerce.revenue

float

Optional

Revenue from the order.

ecommerce.shipping

float

Optional

Shipping cost for the order.

ecommerce.tax

float

Optional

Tax amount for the order.

ecommerce.discount

float

Optional

Discounts applied to the order.

ecommerce.currency

string

Optional

Currency used for the order.

ecommerce.cart_id

string

Optional

Unique identifier of the shopping cart.

ecommerce.cart_url

string

Optional

URL of the shopping cart.

       

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.cart_id

string

Optional

Unique identifier of the shopping cart.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.item_id

string

Required

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.item_category

string

Optional

Category of the product.

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

ecommerce.items.0.item_list_id

string

Optional

Unique identifier of product list.

ecommerce.items.0.item_list_name

string

Optional

Name of product list.

ecommerce.items.0.custom_attribute

object

Optional

Custom attribute for additional data.

billing

object

Optional

Billing information for the order.

billing.first_name

string

Optional

First name of the billing contact.

billing.last_name

string

Optional

Last name of the billing contact.

billing.email

string

Optional

Email of the billing contact.

billing.company

string

Optional

Company name of the billing contact.

billing.address_1

string

Optional

Address line 1 of the billing contact.

billing.address_2

string

Optional

Address line 2 of the billing contact.

billing.city

string

Optional

City of the billing contact.

billing.country

string

Optional

Country of the billing contact.

billing.country_code

string

Optional

Country code of the billing contact.

billing.postal_code

string

Optional

Postal code of the billing contact.

billing.phone

string

Optional

Phone number of the billing contact.

shipping

object

Optional

Shipping information for the order.

shipping.first_name

string

Optional

First name of the shipping contact.

shipping.last_name

string

Optional

Last name of the shipping contact.

shipping.email

string

Optional

Email of the shipping contact.

shipping.company

string

Optional

Company name of the shipping contact.

shipping.address_1

string

Optional

Address line 1 of the shipping contact.

shipping.address_2

string

Optional

Address line 2 of the shipping contact.

shipping.city

string

Optional

City of the shipping contact.

shipping.country

string

Optional

Country of the shipping contact.

shipping.country_code

string

Optional

Country code of the shipping contact.

shipping.postal_code

string

Optional

Postal code of the shipping contact.

shipping.phone

string

Optional

Phone number of the shipping contact.

Example:

<script type="text/javascript">
  !(function (e) {
    // Define the data object with properties for the Order Placed event
    var data = {
  event: "purchase",
  ecommerce: {
order_id: "T_12345",
total_items: 2,
value: 41.04,
revenue: 33.04,
shipping: 0.01,
tax: 0.01,
discount: 0.01,
currency: "USD",
coupon: "SUMMER_SALE",
cart_id: "CART_1",
cart_url: "https://example.com/cart/123",
    items: [
    {
item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
item_list_id: "related_products",
item_list_name: "Related products",
custom_attribute: {}
    },
    {
item_variant: "blue",
item_id: "SKU_54321",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 11.01,
quantity: 1,
index: 2,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
item_list_id: "related_products",
item_list_name: "Related products",
custom_attribute: {}
    }
]
  },
 billing: {
    first_name: "Max",
last_name: "Min",
email: "example@example.com",
company: "COMPANY A",
address_1: "EXAMPLE ADDRESS 1",
address_2: "EXAMPLE ADDRESS 2",
city: "CITY A",
country: "ABC DE",
country_code: "ABC",
postal_code: "123456",
phone: "+01 2345678",
  },
shipping: {
    first_name: "Max",s
last_name: "Min",
email: "example@example.com",
company: "COMPANY A",
address_1: "EXAMPLE ADDRESS 1",
address_2: "EXAMPLE ADDRESS 2",
city: "CITY A",
country: "ABC DE",
country_code: "ABC",
postal_code: "123456",
phone: "+01 2345678",
  },
};
    // Push the Order Placed event to the tracking array
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Refund

This event signifies when one or more items is refunded to a user.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘refund’ for this event type.

ecommerce

object

Required

Event attributes.

ecommerce.order_id

string

Required

Unique identifier of the order.

ecommerce.total_item

int

Optional

Total item of the order.

ecommerce.value

float

Required

Total amount of the order.

ecommerce.revenue

float

Optional

Revenue from the order.

ecommerce.shipping

float

Optional

Shipping cost for the order.

ecommerce.tax

float

Optional

Tax amount for the order.

ecommerce.discount

float

Optional

Discounts applied to the order.

ecommerce.currency

string

Optional

Currency used for the order.

ecommerce.cart_id

string

Optional

Unique identifier of the shopping cart.

ecommerce.cart_url

string

Optional

URL of the shopping cart.

       

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.item_id

string

Required

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.item_category

string

Optional

Category of the product.

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

ecommerce.items.0.item_list_id

string

Optional

Unique identifier of product list.

ecommerce.items.0.item_list_name

string

Optional

Name of product list.

ecommerce.items.0.custom_attribute

object

Optional

Custom attribute for additional data.

billing

object

Optional

Billing information for the order.

billing.first_name

string

Optional

First name of the billing contact.

billing.last_name

string

Optional

Last name of the billing contact.

billing.email

string

Optional

Email of the billing contact.

billing.company

string

Optional

Company name of the billing contact.

billing.address_1

string

Optional

Address line 1 of the billing contact.

billing.address_2

string

Optional

Address line 2 of the billing contact.

billing.city

string

Optional

City of the billing contact.

billing.country

string

Optional

Country of the billing contact.

billing.country_code

string

Optional

Country code of the billing contact.

billing.postal_code

string

Optional

Postal code of the billing contact.

billing.phone

string

Optional

Phone number of the billing contact.

shipping

object

Optional

Shipping information for the order.

shipping.first_name

string

Optional

First name of the shipping contact.

shipping.last_name

string

Optional

Last name of the shipping contact.

shipping.email

string

Optional

Email of the shipping contact.

shipping.company

string

Optional

Company name of the shipping contact.

shipping.address_1

string

Optional

Address line 1 of the shipping contact.

shipping.address_2

string

Optional

Address line 2 of the shipping contact.

shipping.city

string

Optional

City of the shipping contact.

shipping.country

string

Optional

Country of the shipping contact.

shipping.country_code

string

Optional

Country code of the shipping contact.

shipping.postal_code

string

Optional

Postal code of the shipping contact.

shipping.phone

string

Optional

Phone number of the shipping contact.

Example:

<script type="text/javascript">
  !(function (e) {
    // Define the data object with properties for the refund event
    var data = {
  event: "refund",
  ecommerce: {
order_id: "T_12345",
total_items: 2,
value: 41.04,
revenue: 33.04,
shipping: 0.01,
tax: 0.01,
discount: 0.01,
currency: "USD",
coupon: "SUMMER_SALE",
cart_id: "CART_1",
cart_url: "https://example.com/cart/123"
    items: [
    {
      item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
item_list_id: "related_products",
item_list_name: "Related products",
custom_attribute: {}
    },
    {
item_variant: "blue",
item_id: "SKU_54321",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 11.01,
quantity: 1,
index: 2,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
item_list_id: "related_products",
item_list_name: "Related products",
custom_attribute: {}
    }
]
  },
 billing: {
    first_name: "Max",
last_name: "Min",
email: "example@example.com",
company: "COMPANY A",
address_1: "EXAMPLE ADDRESS 1",
address_2: "EXAMPLE ADDRESS 2",
city: "CITY A",
country: "ABC DE",
country_code: "ABC",
postal_code: "123456",
phone: "+01 2345678",
  },
shipping: {
    first_name: "Max",s
last_name: "Min",
email: "example@example.com",
company: "COMPANY A",
address_1: "EXAMPLE ADDRESS 1",
address_2: "EXAMPLE ADDRESS 2",
city: "CITY A",
country: "ABC DE",
country_code: "ABC",
postal_code: "123456",
phone: "+01 2345678",
  },
};
    // Push the refund event to the tracking array
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Product List Viewed 

This event occurs when a user views a list of items.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘view_item_list’ for this event type.

ecommerce

object

Required

Event attributes.

ecommerce.item_list_id

string

Required

The ID of the list in which the item was presented to the user.

Ignored if set at the item-level.

ecommerce.item_list_name

string

Required

The name of the list in which the item was presented to the user.

Ignored if set at the item-level.

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.item_id

string

Required

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.item_category

string

Optional

Category of the product.

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

ecommerce.items.0.item_list_id

string

Optional

The ID of the list in which the item was presented to the user.


If set, event-level item_list_id is ignored.

If not set, event-level item_list_id is used, if present.

ecommerce.items.0.item_list_name

string

Optional

The name of the list in which the item was presented to the user.


If set, event-level item_list_name is ignored.

If not set, event-level item_list_name is used, if present.

ecommerce.items.0.custom_attribute

object

Optional

Custom attribute for additional data.

Example:

<script type="text/javascript">
  !(function (e) {
    // Define the data object with properties for the Product List Viewed event
    var data = {
      event: "view_item_list",
      ecommerce: {
    product_list_id: "related_products",
    product_list_name: "Related products",
    {
item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
item_list_id: "related_products",
item_list_name: "Related products",
custom_attribute: {}
    },
    {
item_variant: "blue",
item_id: "SKU_54321",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 11.01,
quantity: 1,
index: 2,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
item_list_id: "related_products",
item_list_name: "Related products",
custom_attribute: {}
    }
]
    };
    // Push the Product List Viewed event to the tracking array
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Product Viewed

This event occurs when a user views a product on your ecommerce platform.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘view_item’ for this event type.

ecommerce

object

Required

Event attributes.

ecommerce.currency

string

Optional

Currency of price, discount.

ecommerce.value

float

Optional

Total price.

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.item_id

string

Required

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.item_category

string

Optional

Category of the product.

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

ecommerce.items.0.item_list_id

string

Optional

The ID of the list in which the item was presented to the user.

If set, event-level item_list_id is ignored.

If not set, event-level item_list_id is used, if present.

ecommerce.items.0.item_list_name

string

Optional

The name of the list in which the item was presented to the user.

If set, event-level item_list_name is ignored.

If not set, event-level item_list_name is used, if present.

ecommerce.items.0.custom_attribute

object

Optional

Custom attribute for additional data.

Example:

<script type="text/javascript">
  !(function (e) {
    // Define the data object with properties for the Product Viewed event
    var data = {
      event: "view_item",
      ecommerce: {
    currency: "USD",
    value: 30.03,
    items: [

item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
item_list_id: "related_products",
item_list_name: "Related products",
custom_attribute: {}
    }
]
    };
    // Push the Product Viewed event to the tracking array
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

Select item

This event signifies an item was selected from a list.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

 

event

string

Required

Must be ‘select_item’ for this event type.

 

ecommerce

object

Required

Event attributes.

 
ecommerce.item_list_id

string

Optional

The ID of the list in which the item was presented to the user.

Ignored if set at the item-level.

 

ecommerce.item_list_name

string

Optional

The name of the list in which the item was presented to the user.

Ignored if set at the item-level.

 

ecommerce.items

array

Required

Items attributes.

 

ecommerce.items.0.item_variant

string

Required

Variant of the product.

 

ecommerce.items.0.item_id

string

Required

Stock Keeping Unit (SKU) of the product.

 

ecommerce.items.0.item_category

string

Optional

Category of the product.

 

ecommerce.items.0.item_category2

string

Optional

The second category hierarchy or additional taxonomy for the item.

 

ecommerce.items.0.item_category3

string

Optional

The third category hierarchy or additional taxonomy for the item.

 

ecommerce.items.0.item_category4

string

Optional

The fourth category hierarchy or additional taxonomy for the item.

 

ecommerce.items.0.item_category5

string

Optional

The fifth category hierarchy or additional taxonomy for the item.

 

ecommerce.items.0.product_name

string

Required

Name of the product.

 

ecommerce.items.0.item_brand

string

Optional

Brand of the product.

 

ecommerce.items.0.price

float

Optional

Price of the product.

 

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

 

ecommerce.items.0.index

integer

Optional

Position of the product in the list.

 

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

 

ecommerce.items.0.discount

float

Optional

discount of the item.

 

ecommerce.items.0.url

string

Optional

URL of the product.

 

ecommerce.items.0.image_url

string

Optional

URL of the product image

 

ecommerce.items.0.item_list_id

string Optional

The ID of the list in which the item was presented to the user.

If set, event-level item_list_id is ignored.

If not set, event-level item_list_id is used, if present.

 

ecommerce.items.0.item_list_name

string Optional

The name of the list in which the item was presented to the user.

If set, event-level item_list_name is ignored.

If not set, event-level item_list_name is used, if present.

 

ecommerce.items.0.custom_attribute

object Optional

Custom attribute for additional data.

 

 

Example:

<script type="text/javascript">
  !(function (e) {
    // Define the data object with properties for the select item event
    var data = {
      event: "select_item",
item_list_id: "related_products",
item_list_name: "Related products",
      ecommerce: {
     items: [
    {
item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
item_list_id: "related_products",
item_list_name: "Related products",
custom_attribute: {}
    }
]
    };
    // Push the select item event to the tracking array
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

View Promotion

This event signifies a promotion was viewed from a list.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘view_promotion’ for this event type.

ecommerce

object

Required

Event attributes.

ecommerce.creative_name

string

Optional

The name of the promotional creative.

Ignored if set at the item-level.

ecommerce.creative_slot

string

Optional

The name of the promotional creative slot associated with the event.

Ignored if set at the item-level.

ecommerce.promotion_id

string

Optional

The ID of the promotion associated with the event.


Ignored if set at the item-level..

ecommerce.promotion_name

string

Optional

The name of the promotion associated with the event.


Ignored if set at the item-level.

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.sku

string

Optional

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.category

string

Optional

Category of the product.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.position

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

product_list_id

string

Optional

ID of product list view.

product_list_name

string

Optional

Name of product list view.

       

ecommerce.creative_name

string

Optional

The name of the promotional creative.

If set, event-level creative_name is ignored.

If not set, event-level creative_name is used, if present.

ecommerce.creative_slot

string

Optional

The name of the promotional creative slot associated with the item.


If set, event-level creative_slot is ignored.

If not set, event-level creative_slot is used, if present.

ecommerce.promotion_id

string

Optional

The ID of the promotion associated with the item.


If set, event-level promotion_id is ignored.

If not set, event-level promotion_id is used, if present.

ecommerce.promotion_name

string

Optional

The name of the promotion associated with the item.

If set, event-level promotion_name is ignored.

If not set, event-level promotion_name is used, if present.

ecommerce.items.0.item_list_id

string

Optional

The ID of the list in which the item was presented to the user.


If set, event-level item_list_id is ignored.

If not set, event-level item_list_id is used, if present.

ecommerce.items.0.item_list_name

string

Optional

The name of the list in which the item was presented to the user.


If set, event-level item_list_name is ignored.

If not set, event-level item_list_name is used, if present.

ecommerce.items.0.custom_attribute

string

Optional

Custom attribute for additional data.

 

Example:

<script type="text/javascript">
  !(function (e) {
    // Define the data object with properties for the view promotion event
    var data = {
      event: "view_promotion",
      ecommerce: {
creative_name: "Summer Banner",
         creative_slot: "featured_app_1",
          promotion_id: "P_12345",
          promotion_name: "Summer Sale",
     items: [
    {
item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
item_list_id: "related_products",
item_list_name: "Related products",
custom_attribute: {}
    }
]
    };
    // Push the promotion view event to the tracking array
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>

 

Select Promotion

This event signifies a promotion was selected from a list.

_oirtrk.push(['event', data]);

Properties:

Property

Data Type

 

Description

event

string

Required

Must be ‘select_promotion’ for this event type.

ecommerce

object

Required

Event attributes.

ecommerce.creative_name

string

Optional

The name of the promotional creative.

Ignored if set at the item-level.

ecommerce.creative_slot

string

Optional

The name of the promotional creative slot associated with the event.

Ignored if set at the item-level.

ecommerce.promotion_id

string

Optional

The ID of the promotion associated with the event.


Ignored if set at the item-level..

ecommerce.promotion_name

string

Optional

The name of the promotion associated with the event.


Ignored if set at the item-level.

ecommerce.items

array

Required

Items attributes.

ecommerce.items.0.item_variant

string

Required

Variant of the product.

ecommerce.items.0.sku

string

Optional

Stock Keeping Unit (SKU) of the product.

ecommerce.items.0.category

string

Optional

Category of the product.

ecommerce.items.0.product_name

string

Required

Name of the product.

ecommerce.items.0.brand

string

Optional

Brand of the product.

ecommerce.items.0.price

float

Optional

Price of the product.

ecommerce.items.0.quantity

integer

Optional

Quantity of the product in the cart.

ecommerce.items.0.position

integer

Optional

Position of the product in the list.

ecommerce.items.0.coupon

string

Optional

Coupon applied to the product.

ecommerce.items.0.discount

float

Optional

discount of the item.

ecommerce.items.0.url

string

Optional

URL of the product.

ecommerce.items.0.image_url

string

Optional

URL of the product image.

product_list_id

string

Optional

ID of product list view.

product_list_name

string

Optional

Name of product list view.

       

ecommerce.creative_name

string

Optional

The name of the promotional creative.

If set, event-level creative_name is ignored.

If not set, event-level creative_name is used, if present.

ecommerce.creative_slot

string

Optional

The name of the promotional creative slot associated with the item.


If set, event-level creative_slot is ignored.

If not set, event-level creative_slot is used, if present.

ecommerce.promotion_id

string

Optional

The ID of the promotion associated with the item.


If set, event-level promotion_id is ignored.

If not set, event-level promotion_id is used, if present.

ecommerce.promotion_name

string

Optional

The name of the promotion associated with the item.

If set, event-level promotion_name is ignored.

If not set, event-level promotion_name is used, if present.

ecommerce.items.0.item_list_id

string

Optional

The ID of the list in which the item was presented to the user.


If set, event-level item_list_id is ignored.

If not set, event-level item_list_id is used, if present.

ecommerce.items.0.item_list_name

string

Optional

The name of the list in which the item was presented to the user.


If set, event-level item_list_name is ignored.

If not set, event-level item_list_name is used, if present.

ecommerce.items.0.custom_attribute

string

Optional

Custom attribute for additional data.

Example:

<script type="text/javascript">
  !(function (e) {
    // Define the data object with properties for the select promotion event
    var data = {
      event: "select_promotion",
      ecommerce: {
creative_name: "Summer Banner",
         creative_slot: "featured_app_1",
          promotion_id: "P_12345",
          promotion_name: "Summer Sale",
     items: [
    {
item_variant: "green",
item_id: "SKU_12345",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve"
item_brand: "Google",
item_name: "test item name",
price: 10.01,
quantity: 3,
index: 1,
coupon: "SUMMER_FUN",
discount: 2.22,
url: "https://example.com/product/123”,
image_url: "https://example.com/product/123/image",
promotion_id: "P_12345",
promotion_name: "Summer sale",
creative_name: "Summer Banner",
         creative_slot: "featured_app_1",
custom_attribute: {}    
}
]
    };
    // Push the select promotion event to the tracking array
    (e._oirtrk = e._oirtrk || []).push(['event', data]);
  })(window);
</script>