JavaScript API Methods and What They Unlock

Each JavaScript API method offers benefits you can use in the experiences you build. Furthermore, each method you use unlocks more WHO behavioral targets under each corresponding section. More targeting options become available as you provide the platform with more data through each method.

The following information includes examples of best practices. If you have any questions, contact Support (support@monetate.com).

Product-Related Methods

addProducts

WHO Targets Unlocked

None

Action Conditions Unlocked

  • Product list page > List page includes thumbnails where PID =
  • Product list page > List page doesn't include thumbnails where PID =

Description

Use this method to add products that the site visitor views on index or search results pages.

addProductDetails

WHO Targets Unlocked

  • Product viewed
  • Product viewed last visit
  • Product viewed this visit
  • SKU

Action Conditions Unlocked

  • Product detail page > Detail page includes products where PID =
  • Product detail page > Detail page doesn't include products where PID =

Description

With this method you can create an experience that targets visitors who have viewed a certain product during their current visit. Using it also unlocks advanced Recommendations features.

The addProducts and addProductDetails methods are not limited or tied to product or index page types and can be used to target any page type as long as the relevant product IDs are sent to the platform. These methods are tied to the PID information sent to the platform and are independent on the page type sent via the setPagetype method. In the action conditions listed, you can use conditions that require PIDs on any page type. They aren't tied only to index, search, or product page types.

addProductDetails with a Product Catalog

WHO Targets Unlocked

  • Brand in cart
  • Brand last purchased
  • Brand purchased
  • Brand viewed
  • Brand viewed last visit
  • Brand viewed this visit
  • Category in cart
  • Category last purchased
  • Category purchased
  • Category viewed
  • Category viewed last visit
  • Category viewed this visit
  • Viewed product out of stock

Action Conditions Unlocked

  • Product detail page > Detail page includes products where category =
  • Product detail page > Detail page doesn't include products where category =

Description

This method allows you to create an experience that targets visitors who have viewed a specific brand or category.

Site-Related Methods

setPageType

WHO Targets Unlocked

None

Action Conditions Unlocked

  • Page type =
  • Page type ≠

Description

This method allows you to run an experience on all page types using action conditions.

addCartRows

WHO Targets Unlocked

  • Abandoned cart
  • Amount in abandoned cart
  • Amount in cart
  • Average order size
  • Product in abandoned cart
  • Product in cart
  • Quantity in cart

Action Conditions Unlocked

  • Cart value <
  • Cart value ≤
  • Cart value >
  • Cart value ≥

Description

This method allows you to create an experience that targets visitors who have a certain product or amount in their cart.

addPurchaseRows

WHO Targets Unlocked

  • Days since last purchase
  • Last order size
  • Product last purchased
  • Product purchased
  • Products purchased in past days
  • Purchase frequency
  • Purchased any product
  • Purchases in past days

Action Conditions Unlocked

None

Description

This method allows you to create an experience that targets visitors who have purchased any product in the past.

addConversionRows

WHO Targets Unlocked

  • Days since last purchase
  • Last order size
  • Product last purchased
  • Products purchased in past days
  • Purchase frequency
  • Purchased any product
  • Purchases in past days

Some of these targets depend on you having used some of the optional fields outlined below.

Action Conditions Unlocked

None

Description

This method allows you to create an experience that targets visitors who have completed a non-monetary conversion on your site.

addCategories

WHO Targets Unlocked

None

Action Conditions Unlocked

  • Page category contains
  • Page category doesn't contain
  • Page category =
  • Page category ≠
  • Page category starts with
  • Page category doesn't start with
  • Page category ends with
  • Page category doesn't end with

Description

This method adds page categories that the visitor views.

addBreadcrumbs

WHO Targets Unlocked

None

Action Conditions Unlocked

  • Page breadcrumb contains
  • Page breadcrumb doesn't contain
  • Page breadcrumb =
  • Page breadcrumb ≠
  • Page breadcrumb starts with
  • Page breadcrumb doesn't start with
  • Page breadcrumb ends with
  • Page breadcrumb doesn't end with

Description

This method adds a site navigation breadcrumb trail for the visitor.

addPollForElement

WHO Targets Unlocked

None

Action Conditions Unlocked

None

Description

This method adds a delay to the trackData call until some element on the page exists.

addSearch

WHO Targets Unlocked

None

Action Conditions Unlocked

None

Description

The Search and Also Purchased premium recommendation algorithm requires you to implement one or two addSearch methods to send customers' search query data for use with a recommendation strategy configured with this recommendation algorithm.

trackData

WHO Targets Unlocked

None

Action Conditions Unlocked

None

Description

This method sends data that's been pushed to the monetateQ array.

trackEvent

WHO Targets Unlocked

None

Action Conditions Unlocked

None

Description

This method indicates an event has occurred on your site.

setDebug

WHO Targets Unlocked

None

Action Conditions Unlocked

None

Description

This method enables debugging for the Monetate JavaScript API so that you can see console errors.

removeDebug

WHO Targets Unlocked

None

Action Conditions Unlocked

None

Description

This method disables debugging for the Monetate JavaScript API if you had enabled it with the setDebug method.