- 1 Minute to read
- Print
- DarkLight
Mapping Product Arrays to Smart Pixel
- 1 Minute to read
- Print
- DarkLight
If you have a product array in yourdataLayer
, you can use the Product Array Mapper in the Smart Pixel Code Generator to easily submit the data to Smart Pixel. This guide will show you how to do this step-by-step.
Example Scenario
Let's consider a simple example where each product only consists of a name
and a color
. Your dataLayer
could be defined like this:
window.dataLayer.products = [
{name: "Product 1", color: "green"},
{name: "Another Product", color: "red"}
];
Steps to map Product Arrays
Enter the Product Array
In the Product Mapper, enter the product array from your
dataLayer
. For this example, it would bewindow.dataLayer.products
.Select the Smart Pixel Product Method
Choose the Smart Pixel product method you want to use. In this case, we will use the "list" method.
Map the Properties
ID Mapping: We want to use the
name
property as theid
. Therefore, entername
in the field for ID mapping. You can use deeper paths likedata.name
, or if you prefer bracket notation, use["name"]
.Parameter Mapping: Map
parameter 1
to thecolor
key by enteringcolor
.