---
title: addProducts
slug: js-api/addproducts
description: Overview of the Monetate JavaScript API addProducts method and how to use it
image:  https://archbee-image-uploads.s3.amazonaws.com/ceIfEvQHzQk1IVxoRWUh7/K9eTL4jKm7UQINb6zNziJ-20250912-181225.png
docTags: 
createdAt: 2024-04-29T15:50:45.605Z
---

:::CodeblockTabs
addProducts Method

```javascript
// addProducts Method
window.monetateQ.push([
  "addProducts", [{
      "productId": "pidString1",
      "sku": "optionalSkuString1"
    },
    {
      "productId": "pidString2",
      "sku": "optionalSkuString2"
    },
    {
      "productId": "pidString3",
      "sku": "optionalSkuString3"
    }
  ]
]);
```
:::

Use the `addProducts` method to add products that a site visitor views on index, product listing, category listing, or search results pages.

:::hint{type="warning"}
A product ID (PID) can have no more than 50 characters. The API call fails if any PID exceeds this limit.
:::

## Monetate Inspector View

This screenshot shows the **Components** tab of the [Monetate Inspector browser plug-in](https://docs.monetate.com/docs/install-the-monetate-inspector-browser-plug-in). The Product IDs row indicates that the `addProducts` method has passed multiple PID values.

![The Components tab of Monetate Inspector, with product IDs in the Product IDs row](https://dyzz9obi78pm5.cloudfront.net/app/image/id/64f77581c6ab9402b570a339/n/monetate-inspector-components-tab-event-viewpage-page-type-unknown-product-ids-row.png)

This code example contains the method in use that results in the Monetate Inspector results shown in the previous screenshot.

:::CodeblockTabs
addProducts Example

```javascript
// addProducts Example
window.monetateQ = window.monetateQ || [];
window.monetateQ.push([
  "addProducts", ["a123",
    "b456",
    "c789",
    "d123",
    "e456"
  ]
]);
window.monetateQ.push([
  "trackData"
]);
```
:::

