Session parameters always refer to a complete session (visit). In the case of transmitting a parameter multiple times during a visit, the system only evaluates the first or last value of the parameter during the visit (based on the configuration in your account).

An example of the utilization of a session parameter would be the login status of the user. By default, each visit would be indicated as "not logged-in" at the beginning. The successful login is passed to the same parameter and overwrites the first value.

A session parameter cannot be used to add information to a specific webpage, but only to the complete visit. Please use page parameters if you want to analyze information on a specific page of your website or evaluate multiple values of a parameter in the same visit.

  • loginStatus: Pass the current login status of a user.
  • parameter: Session parameters always refer to a complete session (visit). If the value for the parameter is transmitted during a visit several times, only the first or last value is evaluated, based on the configuration of the Mapp Intelligence GUI.

Methods

The session object contains the following four methods, which are contained in the objects data and parameter:

  • 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 {{
 *      [loginStatus=""]: string,
 *      [parameter={}]: {[number]: string}
 * }} data
 *
 * @returns {wtSmart.session.data}
 */
wtSmart.session.data.set(data);
JS

add

/**
 * @param {{
 *      [loginStatus]: string,
 *      [parameter]: {[number]: string}
 * }} data
 *
 * @returns {wtSmart.session.data}
 */
wtSmart.session.data.add(data);
JS

get

/**
 * @returns {{
 *      loginStatus: string,
 *      parameter: {[number]: string}
 * }}
 */
wtSmart.session.data.get();
JS

remove

/**
 * @param {string[]} [removeList]
 *
 * @returns {wtSmart.session.data}
 */
wtSmart.session.data.remove(removeList);
JS

Example

// set session data
wtSmart.session.data.set({
	loginStatus: 'login',
	parameter: {
		5: 'male'
	}
});

// add session data
wtSmart.session.data.add({
    loginStatus: 'logout'
});

// get session data
var data = wtSmart.session.data.get();
  
// remove all session data
wtSmart.session.data.remove();

// remove only loginStatus from session data
wtSmart.session.data.remove(['loginStatus']);
JS

parameter

set

/**
 * @param {{[number]: string}} data
 *
 * @returns {wtSmart.session.parameter}
 */
wtSmart.session.parameter.set(data);
JS

add

/**
 * @param {{[number]: string}} data
 *
 * @returns {wtSmart.session.parameter}
 */
wtSmart.session.parameter.add(data);
JS

get

/**
 * @returns {{[number]: string}}
 */
wtSmart.session.parameter.get();
JS

remove

/**
 * @param {number[]} [removeList]
 *
 * @returns {wtSmart.session.parameter}
 */
wtSmart.session.parameter.remove(removeList);
JS

Example

// set session parameter
wtSmart.session.parameter.set({
    1: 'male'
});

// add session parameter
wtSmart.session.parameter.add({
    7: 'foo.bar'
});

// get session parameter
var data = wtSmart.session.parameter.get();
  
// remove all session parameter
wtSmart.session.parameter.remove();

// remove only session parameter 1
wtSmart.session.parameter.remove([1]);
JS