Products using the Adobe Analytics extension

There is not a dedicated field in Adobe Experience Platform Data Collection to set this variable; however, multiple third-party extensions exist to help.

  1. Log in to Adobe Experience Platform Data Collection using your AdobeID credentials.
  2. Click the desired tag property.
  3. Go to the Extensions tab, then click Catalog to see all available extensions.
  4. Search for the term “product”, which reveals several extensions available to help set this variable.

You can use one of these extensions, or you can use the custom code editor following AppMeasurement syntax below.

s.products in AppMeasurement and the Analytics extension custom code editor

The s.products variable is a string that contains multiple delimited fields per product. Delimit each field with a semicolon (;) in the string.

  • Category (optional): The product category. The maximum length for this field is 100 bytes.
  • Product name (required): The name of the product. The maximum length for this field is 100 bytes.
  • Quantity (optional): How many of this product is in the cart. This field only applies to hits with the purchase event.
  • Price (optional): The total price of the product as a decimal. If quantity is more than one, set price to the total and not the individual product price. Align the currency of this value to match the currencyCode variable. Do not include the currency symbol in this field. This field only applies to hits with the purchase event.
  • Events (optional): Events tied to the product. Delimit multiple events with a pipe (|). See events for more information.
  • eVars (optional): Merchandising eVars tied to the product. Delimit multiple merchandising eVars with a pipe (|). See merchandising eVars for more information.
// Set a single product using all available fields
s.products = "Example category;Example product;1;3.50;event1=4.99|event2=5.99;eVar1=Example merchandising value 1|eVar2=Example merchandising value 2";

This variable supports multiple products in the same hit. It is valuable for shopping cart and purchases containing multiple products. The maximum length for the entire products string is 64k bytes. Separate each product with a comma (,) in the string.

// Set multiple products - useful for when a visitor views their shopping cart
s.products = "Example category 1;Example product 1;1;3.50,Example category 2;Example product 2;1;5.99";
WARNING
Strip all semicolons, commas, and pipes from product names, categories, and merchandising eVar values. If a product name includes a comma, AppMeasurement parses it as the start of a new product. This incorrect parsing throws off the rest of the product string, causing incorrect data in dimensions and reports.

Examples

The products variable is flexible when omitting fields and including multiple products. This flexibility can make it easy to miss a delimiter, which causes your implementation to send incorrect data to Adobe.

// Include only product and category. Common on individual product pages
s.products = "Example category;Example product";

// Include only product name
s.products = ";Example product";

// One product has a category, the other does not. Note the comma and adjacent semicolon to omit category
s.products = "Example category;Example product 1,;Example product 2";

// A visitor purchases a single product; record quantity and price
s.events = "purchase";
s.products = ";Example product;1;6.99";

// A visitor purchases multiple products with different quantities
s.events = "purchase";
s.products = ";Example product 1;9;26.91,Example category;Example product 2;4;9.96";

// Attribute currency event1 only to product 2 and not product 1
s.events = "event1";
s.products = ";Example product 1;1;1.99,Example category 2;Example product 2;1;2.69;event1=1.29";

// Use multiple numeric events in the product string
s.events = "event1,event2";
s.products = ";Example product;1;4.20;event1=2.3|event2=5";

// Use merchandising eVars without any events. Note the adjacent semicolons to skip events
s.products = ";Example product;1;6.69;;eVar1=Merchandising value";

// Use merchandising eVars without category, quantity, price, or events
s.products = ";Example product;;;;eVar1=Merchandising value";

// Multiple products using multiple different events and multiple different merchandising eVars
s.events = "event1,event2,event3,event4,purchase";
s.products = "Example category 1;Example product 1;3;12.60;event1=1.4|event2=9;eVar1=Merchandising value|eVar2=Another merchandising value,Example category 2;Example product 2;1;59.99;event3=6.99|event4=1;eVar3=Merchandising value 3|eVar4=Example value four";

If using the digitalData data layer, you can iterate through the digitalData.product object array:

for(var i = 0; i < digitalData.product.length; i++) {
    // Add individual product info to the product string
    s.products += digitalData.product[i].category.primaryCategory + ";" + digitalData.product[i].productInfo.productName;
    // If there are more products, add a comma
    if(i != digitalData.product.length - 1) {
        s.products += ",";
    }
}

Analytics


Data Drip: Benefits of migrating from an old system to WebSDK

Data Drip

Thursday, Apr 10, 4:00 PM UTC

Join us as Adobe Technical Advisor, Arindam Agarwal, guides us through the benefits of implementing Adobe WebSDK. Arindam will provide an in-depth overview and answer questions live during the Q&A. Register today!

Register

How EY Enhanced Regulatory Knowledge Management with Adobe Solutions

Online | Session | General Audience

Delve into how EY leverages Adobe solutions to enhance regulatory knowledge management. EY leverages search analytics and personalization...

Wed, Mar 19, 4:00 PM PDT (11:00 PM UTC)

Register

Elevate and Empower Teams with Agentic AI for Exceptional Experiences

Online | Strategy Keynote | General Audience

Elevate and empower your CX teams with AI that transforms creativity, personalization, and productivity. Discover how Adobe is...

Tue, Mar 18, 1:00 PM PDT (8:00 PM UTC)

Register

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more