You must include the following for all page types when implementing the Monetate JavaScript API:
monetateQ
— This array contains the necessary instructions for collecting and storing data in the appropriate format to send to Monetate. You must initialize this method on every page that you want to send data to Monetate. ThemonetateQ
array collects and holds all relevant data for Monetate until it's ready to be sent when you call thetrackData
method.trackData
— This method sends the information from themonetateQ
array to Monetate. CalltrackData
after all information has been stored in the array. You can calltrackData
again if any changes are made to the page after the page loads.
Code Example | Tips |
---|---|
// Example window.monetateQ.push([ method, data ]); | Add monetateQ in the page template directly after the Monetate tag |
// setPageType Method window.monetateQ.push([ "setPageType", "main" ]); | The trackData method sends data to Monetate. Place it at the bottom of the page after all other content has been loaded and relevant information has been added to monetateQ . |
// trackData Example window.monetateQ = window.monetateQ || []; window.monetateQ.push([ "setPageType", "main" ]); window.monetateQ.push([ "trackData" ]); | 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. |