Baseline API Call Matrix

The calls that you implement during a baseline Monetate JavaScript API implementation are just the recommended API calls. You can implement more calls to customize your implementation to meet your business needs.

Do not copy the code examples in this documentation into your API deployment. Your team must edit the examples to populate with your data.

AJAX Retracking

If new information or products appear on a page without a new page load, you must retrack, or send a new trackData request, so that the Monetate platform can re-evaluate the page. See AJAX Site Updates for more information.

Product IDs and SKUs in Method Calls

Although both product IDs (PIDs) and SKUs are required in a product catalog, you're only required to implement method calls for PIDs. However, including SKUs enhances the capabilities of both recommendations and product-badging actions.

When choosing a PID to send back to the Personalization platform, use one that is available across all pages when a product is viewed.

Baseline API Calls

Home Page

Sometimes called the landing page, the home page is the main page on your site. It's usually the first page where site visitors see when they arrive.

Method Calls

setPageType

Recommended Page Type

main

Code Example

// Main Page Example
window.monetateQ = window.monetateQ || [];
window.monetateQ.push([
  "setPageType",
  "main"
]);
window.monetateQ.push([
  "trackData"
]);

Index Page

An index page lists multiple products in a grid or listing for site visitors to browse. The products on this type of page are not the result of a search performed by a visitor.

Search pages and index pages use the code format contained in this documentation since they normally follow the same page template for your site. Ensure that you use a different page type for each so that if, for example, you want an action to target index pages but not search pages, you can easily do so with Page Type= action conditions.

Method Calls

setPageType

addProducts

Recommended Page Type

index

Code Example

// Index Page Example
window.monetateQ = window.monetateQ || [];
window.monetateQ.push([
  "setPageType",
  "index"
]);
window.monetateQ.push([
      "addProducts", [{
          "productId": "pidString1",
          "sku": "optionalSkuString1"
        },
        {
          "productId": "pidString2",
          "sku": "optionalSkuString2"
        },
        {
          "productId": "pidString3",
          "sku": "optionalSkuString3"
        },
        {
          "productId": "pidString4",
          "sku": "optionalSkuString4"
        },
        {
          "productId": "pidString5",
          "sku": "optionalSkuString5"
        }
      ]
      window.monetateQ.push([
        "trackData"
      ]);

Search Page

A search page lists multiple products in a grid or listing that are the result of a search the site visitor performed.

Search pages and index pages use the code format contained in this documentation since they normally follow the same page template for your site. Ensure that you use a different page type for each so that if, for example, you want an action to target index pages but not search pages, you can easily do so with Page Type= action conditions.

Method Calls

setPageType

addProducts

Recommended Page Type

search

Code Example

// Search Page Example
window.monetateQ = window.monetateQ || [];
window.monetateQ.push([
  "setPageType",
  "search"
]);
window.monetateQ.push([
  "addProducts", [
  {
    "productId": "pidString1",
    "sku": "optionalSkuString1"
  },
  {
    "productId": "pidString2",
    "sku": "optionalSkuString2"
  },
  {
    "productId": "pidString3",
    "sku": "optionalSkuString3"
  },
  {
    "productId": "pidString4",
    "sku": "optionalSkuString4"
  },
  {
    "productId": "pidString5",
    "sku": "optionalSkuString5"
  }]
])
window.monetateQ.push([
  "trackData"
]);

Product Detail Page

A product detail page, sometimes called simply a product page, contains such key information as available sizes, colors, models, or other variations of a specific product.

Method Calls

setPageType

addProductDetails

Recommended Page Type

product

Code Example

// Product Page Example
window.monetateQ = window.monetateQ || [];
window.monetateQ.push([
  "setPageType",
  "product"
]);
window.monetateQ.push([
  "addProductDetails", [{
    productId: "pidString",
    sku: "optionalSkuString"
  }]
]);
window.monetateQ.push([
  "trackData"
]);

Cart Page

The cart page is any page on your site on which the visitor sees what products are in their cart.

If cart data is available on all pages, Monetate recommends including the addCartRows method to all pages and not just your "cart" page.

Method Calls

setPageType

addCartRows

Recommended Page Type

cart

Code Example

// Cart Page Example
window.monetateQ = window.monetateQ || [];
window.monetateQ.push([
  "setPageType",
  "cart"
]);
window.monetateQ.push([
  "addCartRows", [{
    "productId": "a123",
    "sku": "c678",
    "quantity": "1",
    "unitPrice": "99.99",
    "currency": "USD"
  }, {
    "productId": "b345",
    "sku": "d987",
    "quantity": "3",
    "unitPrice": "29.99",
    "currency": "USD"
  }]
]);
window.monetateQ.push([
  "trackData"
]);

Checkout Page

The checkout page shows registered users a summary of their order details.

Method Calls

setPageType

Recommended Page Type

checkout

Code Example

// Checkout Page Example
window.monetateQ = window.monetateQ || [];
window.monetateQ.push([
  "setPageType",
  "checkout"
]);
window.monetateQ.push([
  "trackData"
]);

Purchase Confirmation Page

The purchase confirmation page loads after a site visitor has completed a transaction.

Method Calls

setPageType

addPurchaseRows

Recommended Page Type

purchase

Code Example

// Purchase Page Example
window.monetateQ = window.monetateQ || [];
window.monetateQ.push([
  "setPageType",
  "purchase"
]);
"window.monetateQ.push([
  "addPurchaseRows", [{
    "purchaseId": "73893797",
    "productId": "a123",
    "sku": "c678",
    "quantity": "1",
    "unitPrice": "99.99",
    "currency": "EUR"
  }, {
    "purchaseId": "73893797",
    "productId": "b345",
    "sku": "d987",
    "quantity": "3",
    "unitPrice": "29.99",
    "currency": "EUR"
  }]
]);
window.monetateQ.push([
  "trackData"
]);