trackData
The trackData method sends all data from the monetateQ array asynchronously to Monetate. This method takes no arguments. Place it at the bottom of the page after all other content has been loaded and relevant information has been added to monetateQ.
Call this method as many times as necessary to give the most current picture of a customer's experience to the Monetate platform.
Each time the trackData method is called, the monetateQ array is cleared so that new data can be pushed.
The trackData method can be used in many instances, such as when a customer views a set of products, filters those products, and is shown a new filtered set. If the site content changes via an AJAX request, the trackData method can be called. See Page Retracks for more information.
When you call trackData more than once because major elements or content on the site have changed (for example, on a single-page application), you must resend all the data to Monetate, including the page type.
This screenshot shows the Components tab of the Monetate Inspector browser plug-in. It shows that two calls to track on the page have been made.
Sometimes the additional call to track on a page appears in Monetate Inspector because a fallback track added to the Monetate tag fires if Monetate doesn't receive a trackData call before the DomContentLoaded browser event. This fallback track is likely what causes the second track due to the use of polling on the fully defined track. Ensure that your API methods and the Monetate tag are installed and defined directly in the page markup and as high in the page header as possible to ensure the trackData call is sent prior to the DomContentLoaded browser event.