1 Overview
Tracking initialization is the first step in configuring Smart Pixel for your website. This setup defines how data is collected and transmitted to Mapp Intelligence. It ensures that every tracking request is associated with the correct account, domain, and data-handling rules.
All tracking configuration is done using the init object. Once configured, this object controls how the pixel behaves across your site. The initialization must be completed before sending any tracking data with track().
2 Tracking Properties
The following properties can be configured when initializing tracking:
Property | Description | Data Type |
|---|---|---|
trackId | Assigns the tracking request to a specific account. To send data to multiple accounts, enter multiple Track IDs as a comma-separated list. | string / array |
trackDomain | Defines the domain to which tracking data is sent. This value is provided by Mapp. | string |
domain | Specifies which (sub)domains should be excluded from Referrer analysis. Add them as a comma-separated list (without https://). Supports wildcards and regex. | string / array / RegExp |
cookie | Defines how cookies are set: browser (client-side) or server. Only use server-side cookies if you use a custom Track Domain matching your web domain. | string |
2.1 Cookie Settings
By default, first-party cookies are used, which are set client-side by your website. These are generally accepted more readily by users and support accurate tracking within a single domain.
You can also choose to use third-party cookies, which are set server-side by Mapp Intelligence. This method is only recommended if you use a custom Track Domain that matches your web domain.
Key Differences
First-party cookies only work within one domain and support subdomains and HTTP/HTTPS changes.
Third-party cookies allow tracking across multiple domains but are less commonly accepted by browsers.
This setting does not affect the user's browser configuration, but rather how the cookie is technically implemented.
3 Methods
The init object supports four methods that allow full control over the tracking configuration:
Method | Description |
|---|---|
set() | Overwrites the entire configuration with the provided values. |
add() | Updates only specific values; existing values are preserved. |
get() | Retrieves the current configuration. |
remove() | Removes the entire configuration or selected properties. |
3.1 Method Details
/**
* @param {{
* trackId: string | string[],
* trackDomain: string,
* [domain=document.location.hostname]: string | string[] | RegExp | RegExp[],
* [cookie="1"]: string
* }} data
*
* @returns {wtSmart.init}
*/
wtSmart.init.set(data);/**
* @param {{
* [trackId]: string | string[],
* [trackDomain]: string,
* [domain]: string | string[] | RegExp | RegExp[],
* [cookie]: string
* }} data
*
* @returns {wtSmart.init}
*/
wtSmart.init.add(data);/**
* @returns {
* trackId: string,
* trackDomain: string,
* domain: string[] | RegExp[],
* cookie: string
* }
*/
wtSmart.init.get();/**
* @param {string[]} [removeList]
*
* @returns {wtSmart.init}
*/
wtSmart.init.remove(removeList);Example
window.wtSmart = window.wtSmart || [];
window.wtSmart.push(function(wtSmart) {
// set initial tracking config
wtSmart.init.set({
trackId: '111111111111111',
trackDomain: 'q3.webtrekk.net',
domain: [
document.location.host,
'*.domain.tld',
'sub.another-domain.*'
],
cookie: '1'
});
// add initial tracking config
wtSmart.init.add({
trackId: ['222222222222222', '111111111111111']
});
// get initial tracking config
var config = wtSmart.init.get();
// remove complete initial tracking config
wtSmart.init.remove();
// remove only domain from initial tracking config
wtSmart.init.remove(['domain']);
});4 Code Generator
Use the Code Generator to create and test custom configurations for your Smart Pixel implementation.