eCommerce Transactions

Clients interested in measuring the impact of user-generated content (UGC) on their sales must implement the trackTransaction analytics event.

Overview eCommerce transactions

The transaction event captures purchase data when a customer buys a product. This event is required on eCommerce sites. Typically, the transaction event is added to a confirmation page, such as a thank you page or payment confirmation page.

📘

You can send email messages to consumers to request reviews or answers to product questions by adding personally identifiable information (PII) parameters to the transaction event.

trackTransaction()

BV.pixel.trackTransaction(TransactionData);

The trackTransaction event should execute once the user has completed a purchase. This will often be after a payment has been processed or when loading a payment confirmation page.

Personal Identifiable Information (PII)

A significant percentage of reviews are collected through follow-up emails sent to verified purchasers. One way to capture a purchaser's personal information (email address, nickname, locale, userId) is by including it in the trackTransaction event. When this occurs, the transactional data is considered to contain personal identifiable information (PII) and must be handled differently than anonymous transaction data.

The analytics code base has a allowlist of expected parameters when handling transactions. If the provided data contains a field that is not allowlisted, the field is assumed to contain PII data. This causes two events to be transmitted. The first event will be of class `PIIConversion` and contain all the fields in `data`. The second event will be of class `Conversion` and will only contain the allowlisted fields from `data`.

By adding PII parameters, you can perform the following:

  • Send personalized email messages to consumers to request reviews if post-interaction email (PIE) is enabled
  • Request answers to product questions if Ask a Product Owner is enabled
  • Send consumers additional notifications about their reviews or questions

Be aware that PII is:

  • Never associated with the Bazaarvoice persistent cookie
  • Always transmitted over HTTPS
  • Encrypted before writing to disk
  • Never processed by Bazaarvoice analytics
  • Stored separately from non-PII data

The following lists the necessary data to execute an eCommerce transactions analytics event.

Arguments

Name Type Default Description Priority
TransactionData Object N/A An object containing data related to the Bazaarvoice products and the eCommerce transaction Required

Usage

This example below is analytics code that would execute on the order confirmation page when capturing PII:

//create the TransactionData object  
var TransactionData = {  
orderId: 'EX-123',  
city: 'Exampleville',  
state: 'Texas',  
country: 'USA',  
email: '[[email protected]](mailto:[email protected])',  
locale: 'fr_CA',  
nickname: 'Test',  
userId: '7448dc2',  
tax: "8.25",  
shipping: "25.00",  
total: "60.00",  
currency: "USD",  
items: [  
  {  
    productId: '1234567-1',  
    name: 'RXV CD player',  
    imageUrl: "<http://www.someserver.com/images/someimage.jpg">,  
    category: "electronics",  
    quantity: '1',  
    price: "50.00",  
    shippingDate: '2016-12-21'  
  },  
  {  
    productId: '1234567-2',  
    name: 'HDMI cable 100 ft',  
    imageUrl: "<http://www.someserver.com/images/someimage.jpg">,  
    category: "cables",  
    quantity: '1',  
    price: "10.00",  
    shippingDelay: '23'  
  }  
]  
};
BV.pixel.trackTransaction(TransactionData);

📘

The productId is the ExternalID and should match the same value sent to Bazaarvoice in the product feed.

📘

Total is the total amount of the product order (all items) with any discounts and coupons applied and without tax and shipping. Represent total value in the English format (two decimal places) without the currency symbol (e.g. "$" for USD).

Transaction data

Field Type Sample value Priority
orderId String 'EX-123' Required
total Number 133.25 Required
currency String 'USD' Required
tax Number 8.25 Recommended
shipping Number 25.00 Recommended
city String 'Austin' Recommended
state String 'TX' Recommended
country String 'USA' Recommended
label String   Recommended
The parameters below should be addressed when considering sending Personal Identifiable Information (PII)
email String '[email protected]' Required
locale String 'en-US' Required
nickname String 'SomeNickname' Required
userId String 'someUserId' Required
shippingDate String Item specific - '2014-12-21' Optional
shippingDelay Number Item specific - '23' Optional
The parameters below are specific to the items[] array. See code sample.
items Array N/A Required
productId String Item specific - '1234567-1' Required
quantity Number Item specific - 3 Required
name String Item specific - 'RXV CD player' Required
price Number Item specific - 50.00 Required
category String Item specific - 'electronics' Optional
imageURL String Item specific - 'http://www.someserver.com/images/someimage.jpg' Optional