Mapping Product Arrays to Smart Pixel
    • 1 Minute to read
    • Dark
      Light

    Mapping Product Arrays to Smart Pixel

    • Dark
      Light

    Article summary

    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

    1. Enter the Product Array

      In the Product Mapper, enter the product array from your dataLayer. For this example, it would be window.dataLayer.products.

    2. 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.

    3. Map the Properties

      • ID Mapping: We want to use the name property as the id. Therefore, enter name in the field for ID mapping. You can use deeper paths like data.name, or if you prefer bracket notation, use ["name"].

      • Parameter Mapping: Map parameter 1 to the color key by entering color.

    Smart Pixel Code Generator


    Was this article helpful?