Session

Prev Next

Sessions are automatically created in Mapp Intelligence when a visitor first triggers a request (for example, a page or event call). You cannot manually start or end a session via the library.

However, you can enrich existing sessions with additional information that applies to the entire visit – for example, the user’s login status, A/B test group, or device type. These details are transmitted as Session Parameters.

The session object also supports a temporary session ID, which helps link multiple requests within the same visit if no persistent cookie is available.


Session Parameters

Session Parameters enrich session-level data with additional information about a visit.

They must be configured in Mapp Q3 before they can be tracked via the library. During setup, you define the data type (text or number) and other attributes for each parameter.

Mapp Intelligence provides a range of predefined Session Parameters for common use cases, such as Login Status, Session Type, or Device Category. Alternatively, you can create custom Session Parameters to capture completely individual session information — for example, automatic website login, A/B test group assignment, NPS feedback, or a persistent shopping cart.

For detailed setup instructions and a full overview of predefined parameters, see How to set up custom parameters.


Method

Description

Where to configure *

Where to analyze

constructor

Initializes a new session object.

–

–

setLoginStatus

Transmits the user’s current login status.

SP > Login Status

Visitors > Session Parameters

setTemporarySessionId

Assigns a temporary session ID to keep the session consistent without persistent storage.

–

–

setParameter

Adds custom session parameters for visit-level information.

SP > Own Configuration

Visitors > Session Parameters

* Config Abbreviations:

  • SP = Mapp Q3 > Configuration > Custom Parameters > Session Parameters > Preconfigured > …

Generated request parameters

Method

Request parameter

Constant

setLoginStatus

cs800

LOGIN_STATUS

setTemporarySessionId

fpv and fpt (always 2.0.0)

TEMPORARY_SESSION_ID and TEMPORARY_SESSION_ID_TYPE

setParameter

cs<ID>

CUSTOM_SESSION_PARAMETER

Note

Values that are empty or exactly 0, 0.0, false or {} are not transmitted. For example, a login status or session parameter with the value 0 or false is not sent. To transmit such a value, send the request with a parameter map (see Request Parameters).

construct

/**
 * MappIntelligenceSession constructor.
 */
$sessionData = new MappIntelligenceSession();

setLoginStatus

/**
 * @param string $loginStatus
 * @return $this
 */
$sessionData->setLoginStatus($loginStatus);

setTemporarySessionId

/**
 * @param string $tSessionId
 * @return $this
 */
$sessionData->setTemporarySessionId($tSessionId);

setParameter

/**
 * @param int $id
 * @param string $value
 * @return $this
 */
$sessionData->setParameter($id, $value);

The IDs 800 to 802 are used by the library: 800 by setLoginStatus, 801 and 802 for the library version and the tracking platform, which are added to every request and overwrite your values. Do not use these IDs with setParameter.

$sessionData = new MappIntelligenceSession();
$sessionData
	->setLoginStatus('logged in')
	->setTemporarySessionId('abc123')
	->setParameter(2, 'param2')
	->setParameter(15, 'param15');

$mappIntelligence = MappIntelligence::getInstance();
$mappIntelligence->track((new MappIntelligenceDataMap())->session($sessionData));