A transaction is the simultaneous purchase of one or more products. The Frosmo Platform registers each transaction, irrespective of the number of products purchased, as a single conversion.

What is transaction tracking?

Transaction tracking is the process of monitoring visitors for actions that qualify as transactions and collecting the data about those actions (transaction data). Transaction tracking also involves counting transactions as conversions and attributing those conversions to modifications, which the Frosmo Platform does automatically when it receives transaction data from a site. The data is stored in the Frosmo back end.

Transaction tracking allows you to monitor the revenue generated by your site and measure Frosmo's impact on that revenue. Transaction tracking is also a prerequisite for implementing features that rely on transaction data, such as generating product recommendations and segmenting visitors based on the products they have purchased, which in turn feed into revenue generation.

Transaction tracking in the Frosmo Platform

Figure: Transaction tracking in the Frosmo Platform (click to enlarge)

Transaction tracking generates transaction and modification statistics, which you can view in the Frosmo Control Panel.

For more information about conversions and conversion attribution, see the conversions user guide.

If you want to track a product conversions that do not involve a purchase, use conversion tracking.

Tracking transactions with the data layer

Tracking transactions with the data layer means triggering a transaction event whenever a visitor successfully completes an action that qualifies as a transaction. The data you pass in the transaction event defines the transaction.

To use the data layer on a site, the data layer module must be enabled for the site.

You can trigger transaction events from:

Tracking transactions by triggering a transaction event from shared code

Figure: Tracking transactions by triggering a transaction event from shared code (click to enlarge)

Triggering transaction events

To trigger a transaction event, call the dataLayer.push() function with a transaction object containing the transaction data:

dataLayer.push({
    transactionProducts: [{
        id: 'string',
        name: 'string',
        price: 0,
        sku: 'string',
        /* Optional */
        quantity: 0
    }],
    /* Optional */
    transactionId: 'string',
    transactionTotal: 0
});

Transaction object

The transaction object contains the data of a transaction event.

Table: Transaction object properties

PropertyDescriptionTypeRole
transactionId

Unique transaction ID.

The platform registers a transaction with a given ID only once. If you trigger a transaction event with the same ID multiple times, the platform ignores all but the first event.


String (32)Optional
transactionProducts

List of products purchased in the transaction.

For more information about the product data, see the following table.

Array of transaction product objectsRequired
transactionTotalTotal purchase value of the transaction.NumberOptional

Table: Transaction product object properties

PropertyDescriptionTypeRole
id

Product ID.

The product ID is the same value you pass in the frosmoProductId property of a product object when tracking products.

This property is optional if name or sku is defined. You must define at least one of the three.

If you do not use the proper product ID as the property value, the platform has no way of mapping the purchased product to the corresponding product in the Frosmo product database. For example, if you wanted to create a product recommendation based on the transactions, the recommendation engine would not be able to map the purchased products to tracked products and would therefore fail to return the product data for the transactions.


String (128)Required/Optional
name

Product name.

The product name is the same value you pass in the frosmoProductName property of a product object when tracking products.

This property is optional if id or sku is defined. You must define at least one of the three.

String (128)Required/Optional
priceUnit price used for the product in the transaction.NumberRequired
quantityNumber of items purchased in the transaction.NumberOptional
sku

Stock keeping unit (SKU) code for the product.

This property is optional if id or name is defined. You must define at least one of the three.

String (128)Required/Optional

Transaction examples

dataLayer.push({
    transactionId: '1010101010',
    transactionProducts: [{
        id: '123456',
        name: 'Cheetah Plushy',
        price: 9.99,
        quantity: 3
    }]
});


dataLayer.push({
    transactionId: '1010101011',
    transactionProducts: [{
        id: '123456',
        name: 'Cheetah Plushy',
        price: 9.99,
        quantity: 3
    }, {
        id: '123457',
        name: 'Lion Plushy',
        price: 19.99,
        quantity: 2
    }]
});

Testing transaction tracking

To test that transactions are correctly tracked with the data layer:

  1. Go to the site.
  2. Enable console logging for Frosmo Core.
  3. Go to a page where transactions are tracked. If transaction events are successfully triggered with the data layer, the browser console displays the following messages for each event:

    The following figure shows an example of the transaction event messages.

    Testing transaction tracking

    Transaction events log a dedicated product.purchase message for each individual purchased item. For example:

    • If a transaction contains three copies of one product, the transaction event logs three product.purchase messages.
    • If a transaction contains three copies of one product and two copies of another product, the transaction event logs five product.purchase messages.


  4. If you want more details on a data layer call, select the Network tab in the developer tools, and check the transaction request to the Optimizer API. If the status is 200, the request completed successfully.

    Testing transaction tracking