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

...

Note

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

For an introduction to product tracking in the Frosmo Platform, see Data tracking overviewoverview#Product tracking.

Tracking products with the data layer means triggering a product view event whenever a visitor navigates to a product page or otherwise views a product on a site. The data you pass in the product view event is the product data for the viewed product.

...

  • Page code (meaning directly from your the site source code)
  • Shared code

...

  • The attribute name must be a string with a maximum length of 32 characters.
  • The data type of the attribute value must be one of the following:
    • Array
    • Boolean
    • Number
    • Object
    • String
  • The attribute value can also be null.
  • The maximum length of the  attribute value is 2048 characters. If the value is an array or object, the length is the JSON-stringified length of the array or object.

If the custom attribute is an object, the object properties can be anything you want them to be. The Frosmo Platform does not validate the properties against any data model or schema.

...

Code Block
languagejs
themeRDark
titleExample: Casino game with standard and custom attributes
collapsetrue
dataLayer.push({
    frosmo: {
        view: {
            products: [{
                /* Standard attributes */
                id: '321',
                brand: 'Microgaming',
                image: 'https://casino.com/images/games/agent-jane-blonde-returns.png',
                name: 'Agent Jane Blonde Returns',
                type: 'Slots/Themed',
                url: 'https://casino.com/games/agent-jane-blonde-returns/launch',

                /* Custom attributes */
                badges: [
                    'new'
                ],
                features: [
                    'respins',
                    'wilds'
                ],
                paylines: 15,
                reels: 5,
                rtp: 96.5,
                volatility: 'low'
            }]
        }
    }
});

Testing product tracking

To For instructions on how to test that products are correctly tracked with the data layer:

...

Select Advanced > Events.

Testing product trackingImage Removed

Go to a page where products are tracked. If product view events are successfully triggered with the data layer, Frosmo Preview shows the following messages for each event:

  • product (contains the product data parsed from a single product object)
  • dataLayer (contains the object passed to the data layer)
  • trigger.event (contains information about the triggered event, including the object passed to the data layer)

Testing product trackingImage Removed

Info

Product view events log a dedicated product message for each product object in the frosmo.view.products array.

...

To verify that the correct product data was sent, check the dataLayer message.

Testing product trackingImage Removed

...

If you want more details on a data layer call, select the Advanced > Requests view in Frosmo Preview, and check the setProductData request to the Optimizer API.

Testing product trackingImage Removed

Triggering product view events (deprecated method)

...

on a site, see Testing data tracking#Product tracking.

Triggering product view events (deprecated method)

Warning

Do not use this method if you are preparing a site for integration with the Frosmo Platform.

...

Expand
titleClick to expand...

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

Code Block
languagejs
themeRDark
dataLayer.push({
    frosmoProductId: 'string',
    /* Optional */
    frosmoProductCategory: 'string',
    frosmoProductData: {},
    frosmoProductDiscountPrice: 0,
    frosmoProductImage: 'string',
    frosmoProductName: 'string',
    frosmoProductPrice: 0,
    frosmoProductPromotionLabel: 'string',
    frosmoProductUrl: 'string'
    /* ... */
});

Product object (deprecated)

The product object contains the data (attributes) for a single product.

Table: Product object properties

PropertyDescriptionTypeRole
frosmoProductId

Product ID.

The Frosmo Platform uses the product ID to uniquely identify the product.

String (256)Required
frosmoProductArea

Geographical region, typically a part of a country, that applies to the product in some way.

For example, if the product is a hotel room, this property can provide the name of the in-country region in which the hotel is located:

  • frosmoProductCountry: Greece
  • frosmoProductArea: Rhodes
  • frosmoProductCity: Lindos
String (32)Optional
frosmoProductCampaignSales or other campaign with which the product is associated.String (32)Optional
frosmoProductCategories

Additional product categories to which the product belongs.

For more information about the object type, see the instructions below this table.

One of:

  • Array of strings
  • Stringified array of strings (1024)
  • Object
  • Stringified object (1024)
Optional
frosmoProductCategory

Product category or type.

Info

Even if you do not have a value for this property, it is recommended that you nonetheless pass an empty string. This property can be used in segmentation rules and therefore needs to have some value.


String (128)Optional
frosmoProductCity

City or town that applies to the product in some way.

For example, if the product is a hotel room, this property provides the name of the city or town in which the hotel is located:

  • frosmoProductCountry: Greece
  • frosmoProductArea: Rhodes
  • frosmoProductCity: Lindos
String (32)Optional
frosmoProductColors

Color options for the product.

For more information about the object type, see the instructions below this table.

One of:

  • Object
  • Stringified object (1024)
Optional
frosmoProductCompanyCompany that offers the product.String (32)Optional
frosmoProductConversion

If you want to merely send the product data to the Frosmo back end without triggering a product view event, set this property to 1. In this case, the Frosmo Platform does not increment the view count for the product, but instead just stores the product data.

The default value is 0, which means that the Frosmo Platform also registers the product data push as a product view.

Note

Despite the name, this property does not trigger a conversion event for the product, regardless of the property value. If you want to register a conversion for the product, trigger a conversion event or transaction event instead.


NumberOptional
frosmoProductCountry

Country that applies to the product in some way.

For example, if the product is a hotel room, this property provides the name of the country in which the hotel is located:

  • frosmoProductCountry: Greece
  • frosmoProductArea: Rhodes
  • frosmoProductCity: Lindos
String (32)Optional
frosmoProductCustomImages

URLs of additional product images.

For more information about the object type, see the instructions below this table.

One of:

  • Object
  • Stringified object (2048)
Optional
frosmoProductData

Any piece of product data that does not logically belong to the other product properties but that you want to push with the product data. Use this property to send your own custom product attributes along with the product data.

For more information about the object type, see the instructions below this table.

One of:

  • Object
  • Stringified object (2048)
Optional
frosmoProductDescriptionProduct description.String (512)Optional
frosmoProductDiscountPriceDiscount unit price for the product.String (32)Optional
frosmoProductIds

Additional product IDs.

For example, if the product consists of multiple child products, you can add their IDs to this property.

For more information about the object type, see the instructions below this table.

One of:

  • Object
  • Stringified object (1024)
Optional
frosmoProductImage

Product image URL.

Info

Even if you do not have a value for this property, it is recommended that you nonetheless pass an empty string.


String (512)Optional
frosmoProductMainCategoryMain product category to which the product belongs.String (128)Optional
frosmoProductManufacturerCompany that produces the product, or the brand name for the product.String (512)Optional
frosmoProductModelProduct model name.String (32)Optional
frosmoProductMultiPrices

Additional unit price options for the product.

For more information about the object type, see the instructions below this table.

One of:

  • Object
  • Stringified object (2048)
Optional
frosmoProductName

Product name.

Info

Even if you do not have a value for this property, it is recommended that you nonetheless pass an empty string.


String (128)Optional
frosmoProductPrice

Unit price for the product.

Info

Even if you do not have a value for this property, it is recommended that you nonetheless pass an empty string.


String (32)Optional
frosmoProductPromotionLabel

Promotion-related label, such as "Weekend Sale" or "80% off!".

Note

This property is intended for promotion-related label strings. Do not use this property for stringified objects. If you need to store extra product data beyond the standard product data properties listed here, use the frosmoProductData property.


String (512)Optional
frosmoProductRatingProduct rating.String (512)Optional
frosmoProductStockNumber of product units in stock.NumberOptional
frosmoProductSubCategory

Subcategory to which the product belongs. The subcategory should be a child category of the main product category.

For example, if the main product category is "Children", the subcategory could be "Clothes" or "Toys".

String (128)Optional
frosmoProductUrl

Product page URL.

Info

Even if you do not have a value for this property, it is recommended that you nonetheless pass an empty string.


String (512)Optional
frosmoProductUrnUniform Resource Names (URN) for the product.String (32)Optional
frosmoProductVenue

Venue in which the product is available.

For example, if the product is a specific showing of a movie, this property would be the movie theater in which the movie is shown.

String (64)Optional


Note
titleObjects

Follow these rules for product object properties whose type is object:

  • The value can be either a JavaScript object or a JSON-stringified object. In the latter case, the maximum length of the string is either 1024 or 2048 characters, depending on the property (see above).
  • The properties of the object can be anything you want them to be. The Frosmo Platform does not validate the properties against any data model or schema.

If you assign a JavaScript object to a product object property, the Frosmo Platform stringifies the value. If you assign a stringified object to a property, the platform stores the value as-is.

Product object examples (deprecated)

Retail

Code Block
languagejs
themeRDark
titleExample: Triggering a product view event with a simple product object
collapsetrue
dataLayer.push({
    frosmoProductId: '123456',
    frosmoProductCategory: 'Plushies',
    frosmoProductDiscountPrice: 9.99,
    frosmoProductImage: '/images/cheetah_plushy.png',
    frosmoProductName: 'Cheetah Plushy',
    frosmoProductPrice: 19.99,
    frosmoProductPromotionLabel: 'Weekend Sale',
    frosmoProductUrl: '/products/123456'
});


Code Block
languagejs
themeRDark
titleExample: Triggering a product view event with a product object containing an object property
collapsetrue
/* frosmoProductColors is a JavaScript object */

dataLayer.push({
    frosmoProductId: '123456',
    frosmoProductCategory: 'Plushies',
    frosmoProductDiscountPrice: 9.99,
    frosmoProductImage: '/images/cheetah_plushy.png',
    frosmoProductName: 'Cheetah Plushy',
    frosmoProductPrice: 19.99,
    frosmoProductPromotionLabel: 'Weekend Sale',
    frosmoProductUrl: '/products/123456',
    frosmoProductColors: {
        black: '#000000',
        blue: '#0000ff',
        lime: '#00ff00',
        red: '#ff0000'
    }
});

/* frosmoProductColors is a JSON-stringified object */

dataLayer.push({
    frosmoProductId: '123456',
    frosmoProductCategory: 'Plushies',
    frosmoProductDiscountPrice: 9.99,
    frosmoProductImage: '/images/cheetah_plushy.png',
    frosmoProductName: 'Cheetah Plushy',
    frosmoProductPrice: 19.99,
    frosmoProductPromotionLabel: 'Weekend Sale',
    frosmoProductUrl: '/products/123456',
    frosmoProductColors: '{"black":"#000000","blue":"#0000ff","lime":"#00ff00","red":"#ff0000"}'
});


Code Block
languagejs
themeRDark
titleExample: Triggering a product view event with minimal data and without incrementing the view count for the product
collapsetrue
dataLayer.push({
    frosmoProductId: '123456',
    frosmoProductConversion: 1
});


Code Block
languagejs
themeRDark
titleExample: Triggering a product view event with multiple product categories for recommendation filtering
collapsetrue
dataLayer.push({
    frosmoProductId: '234567',
    frosmoProductCategory: '',
    frosmoProductCategories: [
        'Accessories',
        'Bedding',
        'Toys'
    ],
    frosmoProductImage: '/images/cheetah_pillow.png',
    frosmoProductName: 'Cheetah Pillow',
    frosmoProductPrice: 29.99,
    frosmoProductUrl: '/products/234567'
});

iGaming

Code Block
languagejs
themeRDark
titleExample: Triggering a product view event where the product is a bet on a sporting event
collapsetrue
dataLayer.push({
    frosmoProductId: 'bet-1234567', // Bet Id
    frosmoProductCategory: 'Football/Germany/Bundesliga', // Combination of main event information
    frosmoProductCountry: 'Germany',
    frosmoProductData: {
        date: '2020-06-12 21:30:00'
    },
    frosmoProductMainCategory: 'Football', // Event category (here, sport name)
    frosmoProductModel: 'Live', // Event type
    frosmoProductName: 'TSG Hoffenheim - RB Leipzig', // Event name
    frosmoProductUrl: '/event/1006388033', // Event URL
    frosmoProductVenue: 'Bundesliga' // Event venue (here, sports league)
});


...

If you want to verify that the product data you're tracking is correctly stored in the Frosmo back end, try retrieving the data with the .Product API v13.0.

Note

The Product API nests all product attributes inside the attributes property, except for id, name, and type, which are returned in the product object root.

...