Pages

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from this space and version 14.7


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.

Table of Contents
maxLevel2

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 PlatformImage Removed

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.

Note

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

...

Warning

This guide is for developers who want to set up data tracking using the default data layer events supported by the Frosmo Platform. If your site has or is getting a basic feature setup from Frosmo, see the appropriate site preparation guide instead. Basic feature setups rely on their own dedicated data layer events.


Note

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

For an introduction to transactions and transaction tracking in the Frosmo Platform, see Data tracking overview.

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.

Note

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

You can trigger transaction events from:

Page code

...

is the recommended solution. If you cannot use the data layer in your page code, use shared code.

Tracking transactions by triggering a transaction event from a pageImage Modified

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

Triggering transaction events

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

Code Block
languagejs
themeRDark
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 a single transaction event.

Table: Transaction object properties

...

PropertyDescriptionTypeRole
id

Product ID.

The product ID is the same value you pass in the id 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.

Note

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 name 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

Code Block
languagejs
themeRDark
titleExample: Triggering a transaction event with one product
collapsetrue
dataLayer.push({
    transactionId: '1010101010',
    transactionProducts: [{
        id: '123456',
        name: 'Cheetah Plushy',
        price: 9.99,
        quantity: 3
    }]
});

...

Code Block
languagejs
themeRDark
titleExample: Triggering a transaction event with two products
collapsetrue
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 For instructions on how to test that transactions are correctly tracked with the data layer:

...

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:

  • EASY [events] info:: conversion (contains the transaction data parsed from the transaction object)
  • EASY [events] info:: product.purchase (contains the ID and price for a single purchased product item)
  • EASY [events] info:: dataLayer (contains the transaction object passed to the data layer)

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

Testing transaction trackingImage Removed

Info

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.

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.

...

on a site, see Testing data tracking.