Pages

A conversion is an action you want your website visitors to take, such as purchasing a product, signing up for a newsletter, downloading a brochure, or watching a video. The most common type of conversion is a transaction, that is, the purchase of one or more products. You track conversions to measure how successfully your site is meeting its business goals: how effectively it gets visitors to do what you want them to do.

Tracking conversions with the data layer means triggering a conversion event whenever a visitor completes an action that qualifies as a conversion. You can track two basic types of conversion events in the Frosmo Platform:

  • Conversion is a conversion event that does not involve a purchase.
  • Transaction is a conversion event that involves the purchase of one or more products.

The data layer supports the following object models for triggering conversion events:

For an introduction to conversions and conversion tracking in the Frosmo Platform, see Introduction to conversion tracking.

For a transaction tracking example that uses the data layer from a modification, see Example: Recommending products purchased together.

Triggering conversion events

To trigger a conversion event, call dataLayer.push() with a conversion object:

Conversion object model
{
    conversionId: 'string',
    conversionType: 'string',
    conversionValue: 0,
    frosmoConversionName: 'string'
}

The call triggers the event and sends the conversion data to the Frosmo back end.

For example, if you want to track a specific file download as a conversion, call dataLayer.push() in response to the click event that occurs when a visitor clicks the file download link.

Use the conversion object also for tracking product conversions that do not involve a purchase. If you want to track product conversions that involve a purchase, use the transaction object.

While you can use the conversion object to track product purchases, it is recommended that you instead use the transaction object for this. The transaction object is not only a more convenient container for purchase data, but also allows you to treat the purchase of multiple products as a single conversion. The conversion object only allows you to track single-product conversions.

Conversion object

The conversion object describes a conversion event. The object properties together define the conversion data.

Table: Conversion object properties

PropertyDescriptionTypeRole
conversionId

Conversion ID.

If you're tracking a product conversion, use the product ID as the conversion ID. The product ID is the same value you pass in the frosmoProductId property of a product object when tracking products.

If you're tracking a product conversion, and if you do not use the product ID as the conversion ID, the platform has no way of mapping the conversion to the corresponding product in the Frosmo database. For example, if you wanted to create a product recommendation based on the conversions, the recommendation engine would not be able to automatically map the conversions to products and would therefore fail to return the product data for the conversions.

String (128)Required
conversionType

Conversion type.

If you're tracking a product conversion, use the product type as the conversion type. The product type is the same value you pass in the frosmoProductCategory property of a product object.

String (128)Required
conversionValue

Monetary value of the conversion (in the currency set for your site).

If you're tracking a product conversion, this property should not reflect the product price, but rather some other monetary value associated with the conversion, as this property does not map to any product data. If you want to track a purchase-based product conversion, use a transaction object instead.

NumberRequired
frosmoConversionName

Conversion description.

If you're tracking a product conversion, use the product name as the conversion description. The product name is the same value you pass in the frosmoProductName property of a product object.

String (128)Required

Examples

Example: Triggering a conversion event
dataLayer.push({
    conversionId: 'download_1',
    conversionType: 'Download',
    conversionValue: 0,
    frosmoConversionName: 'Trial software download'
});
Example: Triggering a product conversion event
// Set the product data variables...

dataLayer.push({
    conversionId: productId,
    conversionType: productType,
    conversionValue: 0,
    frosmoConversionName: productName
});

Triggering transaction events

To trigger a transaction event, call dataLayer.push() with a transaction object:

Transaction object model
{
    transactionProducts: [{
        id: 'string',
        name: 'string',
        price: 0,
        sku: 'string',
        /* Optional */
        quantity: 0
    }],
    /* Optional */
    transactionId: 'string',
    transactionTotal: 0
}

The call triggers the event and sends the transaction data to the Frosmo back end. The transaction is automatically registered as a conversion.

You track transactions to determine which products visitors purchase, how much revenue those purchases generate, and which modifications drive the purchases. You can use the tracking data to, for example, implement product recommendations. If you want to track non-purchase product conversions, use the conversion object.

Transaction object

The transaction object describes a transaction event. The object properties together define the transaction data.

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.

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

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

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

Examples

Example: Triggering a transaction event with one product
dataLayer.push({
    transactionId: '1010101010',
    transactionProducts: [{
        id: '123456',
        name: 'Cheetah Plushy',
        price: 9.99,
        quantity: 3
    }]
});
Example: Triggering a transaction event with two products
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
    }]
});
  • No labels