Pages
Page History
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 | ||
---|---|---|
|
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.
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.
...
...
To use the data layer on a site, the data layer module must be enabled for the site.
You can trigger transaction events from:
- Modifications Page code (either from custom content or, if you're using a template, from the template contentmeaning directly from your site source code)
- Shared code
Page code
...
is the recommended solution. If you cannot use the data layer in your page code, use shared code.
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 | ||||
---|---|---|---|---|
| ||||
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
...
Property | Description | Type | Role | ||
---|---|---|---|---|---|
id | Product ID. The product ID is the same value you pass in the This property is optional if
| String (128) | Required /| Optional | ||
name | Product name. The product name is the same value you pass in the This property is optional if | String (128) | Required /| Optional | ||
price | Unit price used for the product in the transaction. | Number | Required | ||
quantity | Number of items purchased in the transaction. | Number | Optional | ||
sku | Stock keeping unit (SKU) code for the product. This property is optional if | String (128) | Required /| Optional |
Transaction examples
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
dataLayer.push({ transactionId: '1010101010', transactionProducts: [{ id: '123456', name: 'Cheetah Plushy', price: 9.99, quantity: 3 }] }); |
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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:
- Go to the site.
- Enable console logging for Frosmo Core.Launch Frosmo Preview.
Select Advanced > Events.
Go to a page where transactions are tracked. If transaction events are successfully triggered with the data layer, the browser console displays Frosmo Preview shows 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)
trigger.event
(contains information about the triggered event, including the object passed to the data layer)
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.
To verify that the correct transaction data was sent, check the
conversion
message.If you want more details on a data layer call, select the Network tab in the developer tools Advanced > Requests view in Frosmo Preview, and check the
transaction
request to the Optimizer API. If the status is200
, the request completed successfully.