Web setup for ecommerce

This is for:

Developer

In this article, we’ll walk you through the steps you need to take to get Qubit set up on your site for Experimentation Hub clients working in the ecommerce vertical.

Who should use this guide?

This guide is recommended for Experimentation Hub clients looking to implement our Smartserve script (required to drive basic data collection) and those essential QProtocol events required to drive experiences, segmentation, and analytics.

Don’t forget to checkout our Events page for the full QP event specification.

Setup tasks

Perform these tasks in the following order:

  1. Add the UV API script

  2. Add the Smartserve script

  3. Emit events

Add the UV API script

Add on every page:

<script>
!function(){function n(){function n(n){p.level=n}function e(n,e){p.info(n,"event emitted"),e=c(e||{}),e.meta=e.meta||{},e.meta.type=n,u.push(e),r(),v.listeners=f(v.listeners,function(n){return!n.disposed})}function o(n,e,o){function r(){return p.info("Replaying events"),t(function(){s(v.events,function(t){c.disposed||l(n,t.meta.type)&&e.call(o,t)})}),f}function i(){return p.info("Disposing event handler"),c.disposed=!0,f}p.info("Attaching event handler for",n);var c={type:n,callback:e,disposed:!1,context:o||window};v.listeners.push(c);var f={replay:r,dispose:i};return f}function t(n){p.info("Calling event handlers"),a++;try{n()}catch(n){p.error("UV API Error",n.stack)}a--,r()}function r(){if(0===u.length&&p.info("No more events to process"),u.length>0&&a>0&&p.info("Event will be processed later"),u.length>0&&0===a){p.info("Processing event");var n=u.shift();v.events.push(n),t(function(){s(v.listeners,function(e){if(!e.disposed&&l(e.type,n.meta.type))try{e.callback.call(e.context,n)}catch(n){p.error("Error emitting UV event",n.stack)}})})}}function i(n,e,o){var t=v.on(n,function(){e.apply(o||window,arguments),t.dispose()});return t}function s(n,e){for(var o=n.length,t=0;t<o;t++)e(n[t],t)}function c(n){var e={};for(var o in n)n.hasOwnProperty(o)&&(e[o]=n[o]);return e}function l(n,e){return"string"==typeof n?n===e:n.test(e)}function f(n,e){for(var o=n.length,t=[],r=0;r<o;r++)e(n[r])&&t.push(n[r]);return t}var u=[],a=0,p={info:function(){p.level>n.INFO||console&&console.info&&console.info.apply(console,arguments)},error:function(){p.level>n.ERROR||console&&console.error&&console.error.apply(console,arguments)}};n.ALL=0,n.INFO=1,n.ERROR=2,n.OFF=3,n(n.ERROR);var v={on:o,emit:e,once:i,events:[],listeners:[],logLevel:n};return v}"object"==typeof module&&module.exports?module.exports=n:window&&void 0===window.uv&&(window.uv=n())}();
</script>

Add the smartserve.js script

Add on every page:

<script src='https://static.goqubit.com/smartserve-<YOUR_PROPERTY_ID>.js'></script>

Emit events

Events are emitted using the UV API and must conform to a certain schema. Events are emitted using JavaScript, usually on page load or when a new view is rendered on a single page app. An example is shown below:

uv.emit('theEventType', {
  aStringField: 'theValueWhichMustBeTheCorrectType',
  aNumberField: 3,
  aBooleanField: false
})

Indicative events by page type

In the following table, we show an indicative breakdown of a website by page type, alongside the events that could be emitted on each page. This represents a typical set up and there may be exceptions.

Page Available events

All

ecView, ecUser, ecBasketItem, ecBasketSummary

Home

ecView, ecUser, ecBasketItem, ecBasketSummary

Product

ecView, ecUser, ecProduct, ecBasketItem, ecBasketSummary

Listing

ecView, ecUser, ecBasketItem, ecBasketSummary

Basket

ecView, ecUser, ecBasketItem, ecBasketSummary

Checkout

ecView, ecUser, ecBasketItem, ecBasketSummary

Confirmation

ecView, ecUser, ecBasketItemTransaction, ecBasketTransactionSummary

Qubit recommends the following events should be emitted:

These events represent the starting point for setting up Qubit on your site. Additional events are required to drive programmatic experiences.

For an overview of all QProtocol events for the ecommerce vertical, see ecommerce events.

For each of the above events, we identify those fields that are required to integrate with Qubit technology. We also detail other fields that we recommend are emitted for data completeness. Other Qubit products have different event field dependencies, which will be discussed during onboarding.

ecView

The ecView event reports a page view and is a special event because it is required by smartserve.js for data collection and processing. It’s therefore essential that every page emits an ecView event and that it is emitted before any other event.

Emit ecView on every page.

Warning

Any CEH events emitted before the first ecView event are considered invalid. Web and mobile applications emit CEH view events whenever a view is rendered.

Required fields:

  • type

  • subtypes

  • language

  • country

  • currency

Example schema

Field (JS Data Type) Description

type (String)

The type of view. Can be one of account, basket, category, checkout, confirmation, contact, content, help, home, product,registration, search

subtypes (Array of Strings)

An unordered list of subtypes to describe the view

language (String)

The language used in this view. Must be an IETF language tag (for example, en-gb, en-us)

country (String)

The selected country for the view, which must be an ISO 3166-1 alpha-2 code (for example, GB, FR, US)

currency (String)

The ISO 4217 currency code for the visitor (for example, GBP, USD)

Example JavaScript

uv.emit('ecView', {
  type: 'home',
  subtypes: ['Womens', 'Dresses', 'Cocktail Dresses'],
  language: 'en-us',
  country: 'US',
  currency: 'USD'
})

Setup guidelines

type

  • Use only lower-case characters

  • Custom names can be used for unique page types that are not covered by our recommended page types such as home, category, product

  • It is acceptable to use null in the absence of a page type

subtypes

  • Where possible, the array should be aligned with the same structure used for the page breadcrumb, if available

language, country, currency

  • These fields are only required if your site has multiple languages, currencies, or shipping countries. If not, they can be safely omitted

ecUser

The ecUser event is emitted once per view and reports visitor metadata. The event should be emitted on every page as long as there is data available for the user.

For many sites, the event will be present and well populated when the visitor logs on. Websites with a newsletter subscription form that the visitor has previously submitted, might be able to populate the name and email address for the visitor using the data collected on form submission.

Can we omit or hash user.email to comply with our internal data privacy policies?

In short, yes. Both user Id and email can be hashed. However, be aware that to ingest data for use in the Qubit platform, the user Id and email in the provided dataset must be hashed in the same way.

Alternatively, you may choose to omit user.email. The omission of a required field does not prevent the event itself from being sent to Qubit and being processed by our data pipeline–you’ll see a validation error in the Validation Dashboard for the event though.

For further information about our role as a data processor and our obligations and commitments under GDPR, refer to Personal Data and in particular How is customer data treated? For legal clarifications, contact Coveo Support.

Emit ecUser events on every page.

Required fields:

  • user.id

  • user.email

  • user.firstName

  • user.lastName

  • user.username

Example schema

Field (JS Data Type) Description

user.id (String)

A unique user Id. Can be a hash of the username and/or email address

user.email (String)

The visitor’s primary email address

user.username (String)

The visitor’s username

user.firstName (String)

The visitor’s first name

user.lastName (String)

The visitor’s last name

Example JavaScript

uv.emit('ecUser', {
  user: {
    email: 'John.Smith@gmail.com',
    id: 'js123xyz',
    username: 'johnsmith',
    firstName: 'john',
    lastName: 'smith'
  }
})

Setup guidelines

user.id

  • It is acceptable to emit a hashed user Id

user.email

  • It is acceptable to emit a hashed email

ecProduct

Product events report a product loaded on a page. This could be, for example, a main product, a linked product on a product detail page, or a search page.

Warning

This event is not used for Recommendations reporting.

The eventType field differentiates between the different scenarios and can be:

  • detail

  • linked_product

  • other

Emit ecProduct events with an appropriate eventType for the based on one of the scenarios above.

Note

Some data points such as productId must come from QProtocol. Other data points can come from either QProtocol or a product feed. Refer to the Data source column in the following table.

Required fields for product detail pages:

  • eventType

  • product.sku

  • product.productId

  • product.name

  • product.images

  • product.price

  • product.originalPrice

  • product.url

  • product.categories

  • product.stock

  • product.color

  • product.size

  • product.description

  • product.manufacturer - Recommended when a product inventory includes multiple brands

Example schema

Field (JS Data Type) Description

eventType (String)

The type of product event (for example, detail, linked_product)

product.sku (String)

Unique product identifier to distinguish it from variants

product.productId (String)

Id to identify a product and all of its size, color, pattern, material, age, group, gender variants

product.name (String)

The product’s name, which should match the name shown on the product page

product.stock (Number)

The number of available units in stock

product.color (String)

The color of the product

product.size (String)

The size of the product

product.price.value (Number)

The price of the product after discounts, promotions, etc, rounded to 2 decimal places

product.price.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

product.originalPrice.value (Number)

The price of the product before discounts, promotions, etc, rounded to 2 decimal places

product.originalPrice.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

product.url (String)

The URL of the product’s page

product.description (String)

An accurate description of the product, which should match the description on the product page

product.categories (Array of Strings)

A list of one or more product categories the product belongs to. Each category is a full category path, with each level separated by >

product.images (Array of Strings)

An array containing the URLs of the product’s images. The main image you want to use to display the product must be the first element in the array

product.manufacturer (String)

The product manufacturer, recommended when a product inventory includes multiple brands

Warning

¹ Can be taken from a product feed only if the categories in the feed are a one-to-one match with the categories coming from QProtocol.

Example JavaScript for product detail pages

uv.emit('ecProduct', {
  eventType: 'detail',
  product: {
    sku: 'sso-099',
    productId: '1209012233',
    name: 'Nike shoes',
    stock: 20,
    color: 'red',
    size: '12',
    price: {
      currency: 'GBP',
      value: 34
    },
    originalPrice:{
      currency: 'GBP',
      value: 50
    },
    url: 'http://www.fashionunion.com/dresses/red-cocktail-dress.html',
    description: 'This red cocktail dress is perfect for any occasion.',
    categories: [
      'Clothing > Sweaters > Short Sleeve Sweaters',
      'New Arrivals > Clothing'
    ],
    images: [
      'http://www.fashionunion.com/dresses/red-cocktail-dress-1.jpg',
      'http://www.fashionunion.com/dresses/red-cocktail-dress-2.jpg'
    ],
    manufacturer: 'XYZ Dresses'
  }
})

Setup guidelines

product.productId

  • You can include certain attributes, such as color or pattern, but not size, as part of the Id, e.g. SB1799B_BeetleBlue

  • This is not the sku and must not match the value in product.sku. See On Product Ids vs SKUs

  • Keep the value the same when updating your product data

  • Use only valid unicode characters

  • Don’t use if your products differ by design elements that aren’t represented by the above attributes

product.price

  • product.price.value must be rounded to 2 decimal places. See Examples of rounding for more information.

product.OriginalPrice

  • product.OriginalPrice.value must be rounded to 2 decimal places. See Examples of rounding for more information.

product.stock

  • Should only be populated when the product is in stock and the exact number of available units is known

  • Should be NULL if the product is in stock but the exact number of available units is unknown. Should be 0 if the product is out of stock

  • For clients emitting stock levels as a string, 0 can be used to report "Out of stock" items and a positive integer to report "In stock" items

  • Where different product variants have different stock levels, use the maximum stock level

product.url

  • The URL can start with http or https

  • If the URL is not provided, we will fallback to page URL where the event was collected

  • Should be the absolute path and NOT the relative path

product.images

  • The main image you want to use to display the product must be the first element in the array

  • Our recommend minimum image resolution is 375 x 375 pixels. The recommended size is 300kB

product.categories

Warning

It is critical that product.categories is implemented precisely according to our guidelines. See Using Product Categories for more information.

DOs
  • Do provide only the most relevant category, or, alternatively, provide all of categories at once if easier

  • Do provide different categories on different pages, to match the context

    For example, it is acceptable to send New Arrivals > Clothing if visitors arrived via the New Arrivals menu item, and also acceptable to send Clothing > Sweaters > Short Sleeve Sweaters if visitors arrived via the Clothing menu item

  • Do implement a human readable category name that is formatted for display purposes. It can’t be a technical term such as 457, SHOP/NW/CL or B_CLOTHING

  • Do use any number of levels required, e.g. a  b or a  b  c  d are both OK

  • Do match your categories with your website’s breadcrumbs. We recommend this approach, because it will make the content more familiar to customers

DON’Ts
  • Do not include the top level category such as Home or Shop in the category path

  • Do not include the name of the product in the category path

  • Do not use View all in your category structure, for example Tops > View all. Instead, use Tops

product.eventType

  • Strictly 1 ecProduct event with eventType detail should be sent when a visitor opens a product details page

ecBasketItem

Basket events should be emitted on every page as long as there are one or more items in the basket. They should not be emitted on an order summary page. There are two types of basket events that are emitted, ecBasketItem and ecBasketSummary.

Individual items are emitted as ecBasketItem events, each of which contains the summary for the full basket. This denormalization is essential for query performance.

After emitting one or more ecBasketItem events, a ecBasketSummary event should be emitted. If item level detail is not known, it is acceptable to emit just an ecBasketSummary event.

  • basket.subtotal.value reports the basket value before the application of taxes, discounts, promotions, shipping costs, etc

  • basket.subtotalIncludingTax.value reports the basket value after the application of taxes, but before any discounts, promotions, shipping costs, etc

  • basket.total.value reports the basket value after the application of taxes, discounts, promotions, shipping costs, etc

Emit ecBasketItem events for each item in the basket on all pages when the visitor has one or more basket items.

Required fields:

  • basket.total

  • basket.quantity

  • product.sku

  • productId

  • product.name

  • product.price

  • quantity

  • subtotal

  • subtotalIncludingTax

  • basket.id

  • basket.subtotal

  • basket.subtotalIncludingTax

  • product.url

  • product.description

  • product.images

  • product.categories

  • product.color

  • product.size

  • product.originalPrice

  • product.manufacturer

Example schema

Field (JS Data Type) Description

basket.id (String)

Unique basket Id

basket.subtotal.value (Number)

Reports the basket value before the application of taxes, discounts, promotions, shipping costs, etc

basket.subtotal.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

basket.subtotalIncludingTax.value (Number)

Reports the basket subtotal, including tax, but before the application of discounts, promotions, shipping costs, etc

basket.subtotalIncludingTax.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

basket.total.value (Number)

The basket total after the application of discounts, promotions, shipping costs, etc

basket.total.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

basket.quantity (Number)

The total number of items in the basket

product.productId (String)

Id to identify a product and all of its size, color, pattern, material, age, group, gender variants

product.sku (String)

Unique product identifier to distinguish it from variants

product.name (String)

The product name

product.color (String)

The product’s color

product.size (String)

The product’s size

product.price.value (Number)

The price of the product after any discounts, promotions, etc, rounded to 2 decimal places

product.price.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

product.originalPrice.value (Number)

The price the product was originally sold at, before discounts, promotions, etc

product.originalPrice.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

product.url (String)

The URL of the product’s page

product.description (String)

A description of the product

product.manufacturer (String)

The manufacturer of the product

product.categories (Array of Strings)

A list of one or more product categories the product belongs to. Each category is a full category path, with each level separated by >

product.images (Array of Strings)

The product’s images

quantity (Number)

The number of products described by the line item

subtotalIncludingTax.value (Number)

The subtotal of the products described by the line item taking into account the current price and quantity including tax, but before the application of discounts, promotions, shipping costs, etc

subtotalIncludingTax.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

subtotal.value (Number)

The subtotal of the products described by the line item taking into account the current price and quantity before the application of taxes, discounts, promotions, shipping costs, etc

subtotal.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

Example JavaScript

uv.emit('ecBasketItem',{
  basket: {
    id: 'BASK123',
    subtotal: {
      value: 364.00,
      currency: 'USD'
    },
    subtotalIncludingTax: {
      value: 400.00,
      currency: 'USD'
    },
    total: {
      value: 1260.00,
      currency: 'USD'
    },
    quantity: 6,
  },
  product: {
    productId: 1234,
    sku: 'DRESS101',
    name: 'Red Cocktail Dress',
    color: 'red',
    size: '12',

    price: {
      value: 200.00,
      currency: 'USD'
    },
    originalPrice: {
      value: 210.00,
      currency: 'USD'
    },
    url: 'http://www.fashionunion.com/dresses/red-cocktail-dress.html',
    description: 'This red cocktail dress is perfect for any occasion.',
    manufacturer: 'XYZ Dresses',
    categories: [
      'Clothing > Sweaters > Short Sleeve Sweaters',
      'New Arrivals > Clothing'
    ],
    images: [
      'http://www.fashionunion.com/dresses/red-cocktail-dress-1.jpg',
      'http://www.fashionunion.com/dresses/red-cocktail-dress-2.jpg'
    ]
  },
  quantity: 2,
  subtotalIncludingTax: {
    value: 400.00,
    currency: 'USD'
  },
  subtotal: {
    value: 364.00,
    currency: 'USD'
  }
})

Setup guidelines

basket.subtotalIncludingTax

  • Should be emitted when the listed subtotal on the page includes taxes. Emit basket.subtotal when the subtotal does not include taxes

  • Emit either basket.subtotalIncludingTax OR basket.subtotal

  • basket.subtotalIncludingTax.value must be rounded to 2 decimal places. See Examples of rounding for more information

basket.total

  • basket.total.value must be rounded to 2 decimal places. See Examples of rounding for more information

product.productId, product.stock, product.price, product.url, product.categories, product.images

  • See ecProduct above

quantity

  • Will be 1 unless there is more than 1 of the same product in the basket subtotal

subtotal

  • Should be the same as the product price unless there is more than 1 of the same product in the basket

  • subtotal.value must be rounded to 2 decimal places. See Examples of rounding for more information

ecBasketSummary

Emitted each time the basket is shown to the visitor either as an inline minibasket or in a view that shows only the basket. If the visitor’s basket is changed in any way, the summary is emitted again.

  • basket.subtotal.value reports the basket value before the application of taxes, discounts, promotions, shipping costs, etc

  • basket.subtotalIncludingTax.value reports the basket value after the application of taxes, but before any discounts, promotions, shipping costs, etc

  • basket.total.value reports the basket value after the application of taxes, discounts, promotions, shipping costs, etc

Emit an ecBasketSummary event on all pages when the visitor has one or more basket items.

Required fields:

  • basket.total

  • basket.quantity

  • basket.subtotal

  • basket.subtotalIncludingTax

Example schema

Field (JS Data Type) Description

basket.subtotal.value (Number)

Reports the basket value before the application of taxes, discounts, promotions, shipping costs, etc

basket.subtotal.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

basket.subtotalIncludingTax.value (Number)

Reports the basket subtotal, including tax, but before the application of discounts, promotions, shipping costs, etc

basket.subtotalIncludingTax.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

basket.total.value (Number)

The basket value after the application of taxes, discounts, promotions, shipping costs, etc, rounded to 2 decimal places

basket.total.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

basket.quantity (Number)

The total number of items in the basket

Example JavaScript

uv.emit('ecBasketSummary',{
  basket: {
    subtotal: {
      value: 150.00,
      currency: 'USD'
    },
    subtotalIncludingTax: {
      value: 68.00,
      currency: 'GBP'
    },
    total: {
      value: 75.00,
      currency: 'GBP'
    },
    quantity: 1
  }
})

Setup guidelines

basket.subtotalIncludingTax and basket.total

ecBasketItemTransaction

Transaction events are very important because they report revenue for your website. They are set up in a similar way to basket events except they should only be set up on an order summary page and they must include transaction.id.

This event collects granular information about individual products contained within a transaction. It enables segmentation based on product preferences, including category, price, color, etc.

  • basket.subtotal.value reports the basket value before the application of taxes, discounts, promotions, shipping costs, etc

  • basket.subtotalIncludingTax.value reports the basket value after the application of taxes, but before any discounts, promotions, shipping costs, etc

  • basket.total.value reports the basket value after the application of taxes, discounts, promotions, shipping costs, etc

Emit ecBasketItemTransaction events for each item in the basket on the order summary page.

Required fields:

  • transaction.id

  • basket.total

  • product.sku

  • product.productId

  • product.name

  • product.url

  • product.images

  • product.categories

  • product.price

  • product.originalPrice

  • product.manufacturer

  • quantity

  • subtotal

  • subtotalIncludingTax

  • product.description

  • product.color

  • product.size

  • basket.id

  • basket.subtotal

  • basket.subtotalIncludingTax

Example schema

Field (JS Data Type) Description

basket.id (String)

Unique basket Id

basket.subtotal.value (Number)

Reports the basket value before the application of taxes, discounts, promotions, shipping costs, etc

basket.subtotal.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

basket.total.value (Number)

The basket total after the application of discounts, promotions, shipping costs, etc

basket.total.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

basket.quantity (Number)

The total number of items in the basket

basket.subtotalIncludingTax.value (Number)

Reports the basket subtotal, including tax, but before the application of discounts, promotions, shipping costs, etc

basket.subtotalIncludingTax.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

product.sku (String)

Unique product identifier to distinguish it from variants

product.productId (String)

Id to identify a product and all of its size, color, pattern, material, age, group, gender variants

product.name (String)

The product name

product.color (String)

The product’s color

product.size (String)

The product’s size

product.price.value (Number)

The price of the product after any discounts, promotions, etc, rounded to 2 decimal places

product.price.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

product.originalPrice.value (Number)

The price the product was originally sold at, before discounts, promotions, etc

product.originalPrice.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

product.url (String)

The URL of the product’s page

product.description (String)

A description of the product

product.manufacturer (String)

The manufacturer of the product

product.categories (Array of Strings)

A list of one or more product categories the product belongs to. Each category is a full category path, with each level separated by >

product.images (Array of Strings)

The product’s images

quantity (Number)

The number of products described by the line item

subtotalIncludingTax.value (Number)

The subtotal of the products described by the line item taking into account the current price and quantity including tax, but before the application of discounts, promotions, shipping costs, etc

subtotalIncludingTax.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

subtotal.value (Number)

The subtotal of the products described by the line item taking into account the current price and quantity before the application of taxes, discounts, promotions, shipping costs, etc

subtotal.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

transaction.id (String)

A unique transaction Id

Example JavaScript

uv.emit('ecBasketItemTransaction',{
  basket: {
    id: 'BASK123',
    subtotal: {
      value: 200.00,
      currency: 'USD'
    },
    total: {
      value: 250.00,
      currency: 'USD'
    },
    quantity: 10,
    subtotalIncludingTax: {
      value: 250.00,
      currency: 'USD'
    }
  },
  product: {
    sku: 'DRESS101',
    productId: 1234,
    name: 'Red Cocktail Dress',
    stock: 20,
    color: 'Red',
    size: 12,
    price: {
      value: 200.00,
      currency: 'USD'
    },
    originalPrice: {
      value: 225.00,
      currency: 'USD'
    },
    url: 'http://www.fashionunion.com/dresses/red-cocktail-dress.html',
    description: 'This red cocktail dress is perfect for any occasion.',
    manufacturer: 'Dress Inc',
    categories: ['Dresses'>'Cocktail Dresses'>'Red'],
    images: [
      'http://www.fashionunion.com/dresses/red-cocktail-dress-1.jpg',
      'http://www.fashionunion.com/dresses/red-cocktail-dress-2.jpg'
    ],
  },
  quantity: 1,
  subtotalIncludingTax: {
    value: 240.00,
    currency: 'USD'
  },
  subtotal: {
    value: 212.00,
    currency: 'USD'
  },
  transaction: {
    id: '83748372'
    }
})

Setup guidelines

transaction.id

  • Use only valid unicode characters

basket.subtotalIncludingTax, basket.subtotal, basket.total, product.productId, product.stock, product.price, product.url, product.categories, product.images, quantity, subtotal

ecBasketTransactionSummary

Emitted on order summary pages, this event collects a summary of information about the transaction. Most importantly, this event is used to count conversions and the associated revenue.

  • basket.subtotal.value reports the basket value before the application of taxes, discounts, promotions, shipping costs, etc

  • basket.subtotalIncludingTax.value reports the basket value after the application of taxes, but before any discounts, promotions, shipping costs, etc

  • basket.total.value reports the basket value after the application of taxes, discounts, promotions, shipping costs, etc

Emit an ecBasketTransactionSummary event on the order summary page after ecBasketItemTransaction events.

Required fields:

  • transaction.id

  • basket.total

  • basket.quantity

  • basket.subtotal

  • basket.subtotalIncludingTax

Example schema

Field (JS Data Type) Description

transaction.id (String)

A unique transaction Id

basket.subtotal.value (Number)

Reports the basket value before the application of taxes, discounts, promotions, shipping costs, etc

basket.subtotal.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

basket.total.value (Number)

The basket total after the application of discounts, promotions, shipping costs, etc

basket.total.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

basket.quantity (Number)

The total number of items in the basket

basket.subtotalIncludingTax.value (Number)

The basket value after the application of taxes, but before the application of discounts, promotions, shipping costs, etc

basket.subtotalIncludingTax.currency (String)

The ISO 4217 currency code (for example, GBP, USD)

Example JavaScript

uv.emit('ecBasketTransactionSummary', {
  transaction: {
    id: '83748372'
  },
  basket: {
    subtotal: {
      value: 200.00,
      currency: 'USD'
    },
    total: {
      value: 250.00,
      currency: 'USD'
    },
    quantity: 10,
    subtotalIncludingTax: {
      value: 250.00,
      currency: 'USD'
    }
  }
})

Setup guidelines

transaction.id

  • Use only valid unicode characters

basket.subtotalIncludingTax and basket.total