- 2 Minutes to read
- Print
- DarkLight
init
- 2 Minutes to read
- Print
- DarkLight
The init object is needed to initialize tracking. The following configuration options are available:
Configuration options | Description |
---|---|
trackId | Enter your Track ID here. If the same information should be sent to several accounts, simply enter the corresponding Track IDs separated by a comma. How to get the Track ID:
|
trackDomain | Enter the domain, where the data should be sent to. If you are using a Mapp Intelligence Track Domain, you will find it in the setup information, which has been sent to you via email. |
domain | By default, the domain that includes the Smart Pixel is not counted as a referrer in Mapp Intelligence. Here you can override this setting. Add all (sub)domains that should be excluded from this analyses (e.g. your own domain, payment providers etc.). Enter as a comma-seperated list of domains and subdomains without http(s). You can use regular expressions and wildcards (*).
|
cookie | Please indicate if you want to set the cookie via the browser or the server. We only recommend using server-side cookies if you are using a custom Track Domain and the Track Domain is the same as your web domain. This allows first-party tracking and the highest data quality. |
1st / 3rd party cookies
By default, first-party cookies are used. When using first-party cookies, all cookies will be set client-side by your website. With third-party cookies, Mapp Intelligence sets the cookie server-side.
Acceptance of first-party cookies is generally higher than for third-party cookies. The disadvantage of first-party cookies is that they only are valid for one domain. Hence, when you use them, visits on websites distributed across multiple domains (e.g. www.website.com and www.website-special.com) cannot be tracked as a continuous visit. Tracking switches between various sub-domains (e.g. www1.website.com and www2.website.com) or HTTP/HTTPS are supported.
This does not affect the cookie settings of the user, but the way cookies are set via Mapp Intelligence. When using first-party cookies, the pixel sets a cookie to recognize a (returning) user. When using third-party cookies, the Mapp Intelligence track server sets the necessary cookie and saves it into the track domain.
Methods
The init object contains the following methods:
Method | Description |
---|---|
set | Overwrites all existing values. |
add | Overwrites only the corresponding values. |
get | Returns the current configuration. |
remove | Removes the current configuration or individual values. |
set
/**
* @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);
add
/**
* @param {{
* [trackId]: string | string[],
* [trackDomain]: string,
* [domain]: string | string[] | RegExp | RegExp[],
* [cookie]: string
* }} data
*
* @returns {wtSmart.init}
*/
wtSmart.init.add(data);
get
/**
* @returns {
* trackId: string,
* trackDomain: string,
* domain: string[] | RegExp[],
* cookie: string
* }
*/
wtSmart.init.get();
remove
/**
* @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']);
});
Code Generator
Use the code generator to create individual code that you can then integrate directly into the website.