- 2 Minutes to read
- Print
- DarkLight
event
- 2 Minutes to read
- Print
- DarkLight
Any website event can be tracked as in Mapp Intelligence. Events can be simple, like clicking on links or advanced, like tracking scroll or content engagement events.
You will find tracked events under Navigation > Events.
Event tracking requires active JavaScript in the visitor's browser.
It needs:
name: Unique identification of the event.
parameter: Use parameters to enrich analytical data with your own specific information and/or metrics. Make sure you use the syntax guidelines when defining parameters.
goal: Needed when website goals are based on events.
Parameter
Event parameters must be set up under Configuration > Custom Parameters > Event Parameter before they can be used. During setup, each parameter's ID and data type (text/number) are defined.
Goals
Website goals help to track the success of your website. Find more information here.
As soon as a parameter is tracked (no matter which value is submitted), the goal is set as achieved. Therefore it does not make sense to submit the value "no" for the goal "Newsletter Registration" if a user has not registered for the newsletter. Setting the value to "no" would instead mark the goal as achieved.
Methods
The action object contains the following four methods, which are contained in the objects data, parameter and goal:
set: Overwrites all existing values.
add: Overwrites only the corresponding values.
get: Returns the current configuration.
remove: Removes the current configuration or individual values.
data
set
/**
* @param {{
* [name]: string,
* [parameter={}]: {[number]: string},
* [goal={}]: {[number]: string}
* }} data
*
* @returns {wtSmart.action.data}
*/
wtSmart.action.data.set(data);
add
/**
* @param {{
* [name]: string,
* [parameter]: {[number]: string},
* [goal]: {[number]: string}
* }} data
*
* @returns {wtSmart.action.data}
*/
wtSmart.action.data.add(data);
get
/**
* @returns {{
* name: string,
* parameter: {[number]: string},
* goal: {[number]: string}
* }}
*/
wtSmart.action.data.get();
remove
/**
* @param {string[]} [removeList]
*
* @returns {wtSmart.action.data}
*/
wtSmart.action.data.remove(removeList);
Example
// set action data
wtSmart.action.data.set({
name: 'en.click.on.some.link',
parameter: {
1: 'en'
},
goal: {
2: 'goal value 2'
}
});
// add action data
wtSmart.action.data.add({
name: 'en.click.on.some.link2'
});
// get action data
var data = wtSmart.action.data.get();
// remove all action data
wtSmart.action.data.remove();
// remove only name
wtSmart.action.data.remove(['name']);
parameter
set
/**
* @param {{[number]: string}} data
*
* @returns {wtSmart.action.parameter}
*/
wtSmart.action.parameter.set(data);
add
/**
* @param {{[number]: string}} data
*
* @returns {wtSmart.action.parameter}
*/
wtSmart.action.parameter.add(data);
get
/**
* @returns {{[number]: string}}
*/
wtSmart.action.parameter.get();
remove
/**
* @param {number[]} [removeList]
*
* @returns {wtSmart.action.parameter}
*/
wtSmart.action.parameter.remove();
Example
// set action parameter
wtSmart.action.parameter.set({
1: 'en'
});
// add action parameter
wtSmart.action.parameter.add({
1: 'de',
7: 'foo.bar'
});
// get action parameter
var data = wtSmart.action.parameter.get();
// remove all action parameter
wtSmart.action.parameter.remove();
// remove only action parameter 7
wtSmart.action.parameter.remove([7]);
goal
set
/**
* @param {{[number]: string}} data
*
* @returns {wtSmart.action.goal}
*/
wtSmart.action.goal.set(data);
add
/**
* @param {{[number]: string}} data
*
* @returns {wtSmart.action.goal}
*/
wtSmart.action.goal.add(data);
get
/**
* @returns {{[number]: string}}
*/
wtSmart.action.goal.get();
remove
/**
* @param {number[]} [removeList]
*
* @returns {wtSmart.action.goal}
*/
wtSmart.action.goal.remove(removeList);
Example
// set action goal
wtSmart.action.goal.set({
5: 'goal value 5'
});
// add action goal
wtSmart.action.goal.add({
8: 'goal value 8'
});
// get action goal
var goal = wtSmart.action.goal.get();
// remove all action goals
wtSmart.action.goal.remove();
// remove only action goal 8
wtSmart.action.goal.remove([8]);
Code Generator
Use the code generator to create individual code that you can then integrate directly into the website.