# Mapp

URL: https://docs.ablyft.com/developers/integrations/mapp/

> Pass the experiment and variation a visitor saw to Mapp Intelligence as a session parameter.



With a custom integration, ABlyft writes the variation of an experiment into a Mapp Intelligence session parameter. In
Mapp you can then analyze visitors by variation.

## What you need

* The Mapp Intelligence Smart Pixel (`wtSmart`) on your site.
* A session parameter in Mapp with a parameter ID of your choice and the data type **Text**. Create it under
  **Configuration → Custom Parameters → Session Parameters** in Mapp. In this page the ID is `51`. Replace it with your own.
* An ABlyft project with an active subscription, because Custom Integrations are part of it.

## Create the integration in ABlyft

1. Open **Project → Integrations → Custom Integrations** and create a new integration, for example `Mapp`.
2. Set the trigger to **Experiment viewed** (default) or **User bucketed**.
3. Paste the code from the next section and save.

More about the fields and how integrations run: [Custom Integrations](https://docs.ablyft.com/developers/integrations/custom-integrations/).

## Integration code

The code uses the constants `experimentName` and `variationName`. They are also available as `experiment.data.name` and
`variation.data.name`.

```js
if (typeof wtSmart === 'undefined') {
  throw new Error('Mapp Smart Pixel not loaded yet');
}

// 51 = your session parameter ID in Mapp
var parameter = {};
parameter[51] = experimentName + ': ' + variationName;
wtSmart.session.parameter.add(parameter);
```

`add` updates only this ID and keeps other session parameters. Do not use `set`, because it overwrites all existing
session parameters. Running the code twice sets the same value twice.

If a visitor is in several experiments, one parameter ID holds only one value. Create one parameter per experiment and use
a different ID in each integration, or accept that the newest value is used.

## Where you see the data in Mapp

Text session parameters appear in Mapp Q3 under **Visitors → Session Parameters**. Use the parameter as a dimension to
break down your metrics by the value, for example `Checkout: Variation 1`. A session parameter belongs to the whole
visit, not to a single page. You cannot tie it to one page.

## Check the setup

1. Preview an experiment with **Run in preview mode** switched on for the integration.
2. In the browser console, run `wtSmart.session.parameter.get()`. The returned object contains your ID and value.
3. In the network tab, look at the tracking request to Mapp. The session parameter is sent as `cs51` (with your ID).

## Notes

> **Consent and limits:** Custom integrations do not run when a visitor opted out or sends Do Not Track. Mapp may also need its own consent
> category. If the Smart Pixel loads only after consent, the integration waits at most about 2 seconds.

> **Check before use:** ABlyft with Mapp is not tested by us. Mapp documents `wtSmart.session.parameter.add`, but we could not verify when the
> value must be set in relation to the Smart Pixel tracking request. Check in the network tab that `cs51` is sent with a
> tracking request after the value is set. Older Smart Pixel versions use a different call (`wts.push`), which we could not
> verify, so this page does not show it. Mapp evaluates the first or the last value of a parameter in a visit, depending on
> your account configuration. Ask your Mapp contact which one is active.

[Mapp documentation](https://docs.mapp.com/docs/intelligence-smart-pixel-sessions)

