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.
You must include the following for all page types when implementing the Monetate JavaScript API.
This method sends the information from the monetateQ array to Monetate. Call trackData after all information has been stored in the array. You can call trackData again if any changes are made to the page after the page loads.
Place it at the bottom of the page after all other content has been loaded and relevant information has been added to monetateQ.
When you call trackData more than once because major elements or content on the site has changed (for example, on a single-page application), you must resend all the data to Monetate, including the page type.
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 Page Retracks for more information.
All data that you pass to Monetate through the methods included in this API must be in the form of a string. Passing an integer instead of a string or omitting quotation marks around a string ("string") results in an error.
All strings passed to Monetate need to be in a valid format. These strings are listed below. The API references the following types:
- string is a JavaScript typeof string that cannot be empty.
- idString is a string without spaces.
- pidString is an idString with no more than 50 characters.
- quantityString is an idString composed only of numerals. The number must be greater than zero and less than one billion.
- priceString is an idString made up of any number of numerals followed by an optional period and by one or two optional numerals.
- currencyString is an idString that must adhere to the ISO 4217 format of three capital letters and no spaces.
Certain properties available for each method call have a maximum field length. Any field with a maximum length is listed in this table.
Attribute | Data Type | Maximum | Example |
---|---|---|---|
purchase_id | VARCHAR | 50 | "123456789" |
sku | VARCHAR | 50 | "123456789" |
pid | VARCHAR | 50 | "123456789" |
quantity | INT | 11 | "123456789101" |
unit_price | DECIMAL | 9,2 | "900999500.00" |
currency | VARCHAR | 3 | "$" |
trackEvent | VARCHAR | 32 | "50140" |
Duplicate purchase_id entries are removed. Each entry's purchase_id must be unique. Furthermore, subsequent purchase_id entries don't need to be incremental.
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 Product Recommendations and product-badging actions.
When choosing a PID to send back to Monetate, use one that is available across all pages when a product is viewed.