- 1 Minute to read
- Print
- DarkLight
Send Tracking Data
- 1 Minute to read
- Print
- DarkLight
1 Overview
This step sends the collected tracking data to the Mapp Intelligence servers. It’s a core part of the tracking process and must follow the initialization and configuration of data.
Once the request is sent, the data is automatically cleared from the cache. If you need to retain the data (e.g., for single-page applications), you can keep it in memory by passing true as an argument. In this case, the data must be manually removed later using .remove().
Important: Tracking only works if the script is wrapped in the Smart Pixel’s push() function.
2 Available Methods
The Smart Pixel provides the following methods to send tracking requests:
Method | Description |
---|---|
| Sends all tracking data and clears it from the internal cache by default. |
| Forces a page request (page view). |
| Forces an event or interaction request. |
Each method accepts an optional keepData
parameter (boolean) to decide whether the data should be retained after sending.
2.1 Method Details
/**
* @param {boolean=false} [keepData]
*/
wtSmart.track(keepData);
/**
* @param {boolean=false} [keepData]
*/
wtSmart.trackPage(keepData);
/**
* @param {boolean=false} [keepData]
*/
wtSmart.trackAction(keepData);
Example
window.wtSmart = window.wtSmart || [];
window.wtSmart.push(function(wtSmart) {
// set initial tracking config
wtSmart.init.set({
trackId: '111111111111111',
trackDomain: 'q3.webtrekk.net'
});
// set page data
wtSmart.page.data.set('en.index.home');
// send tracking data and remove data after the request
wtSmart.track();
// send tracking data and keep data
wtSmart.track(true);
});
3 Code Generator
Use the code generator to create tracking configurations that can be directly embedded into your website.