Qualifio data layer
qlfDatalayer
is a JavaScript variable available from any Tag embedded in your campaign. It contains useful data related to the current state and the last event of the campaign.
Example
<script>
qlfDataLayer = [{'title': 'My Campaign name', 'campaign_id': '720104',
'campaign_guid': 'E78A60AF-B117-436D-B89B-EF1459DCB69C',
'channel_guid': '64E87575-1D90-41B3-8171-C151D21C251F',
'parentURL': 'https://qualifio.com/catalogue/', 'domain': 'qualifioshowcases.qualifioapp.com',
'device': 'desktop', 'lg': 'fr', 'pg': '1', 'step': 'intro', 'pgi': '1',
'page_path': '/720104/fr/1/intro/1', 'optins': [], 'form_submitted': 0,
'isIdentified': 1, 'isWinner': null, 'preview': false, 'query_string': '&utm_source=newsletter'}];
</script>
Keys and values
Key | Example of value | Description |
---|---|---|
title | My Campaign name | Title of the campaign |
campaign_id | 720104 | Identifier of the campaign (= 6 numbers) |
campaign_guid | E78A60AF-B117-436D-B89B-EF1459DCB69C | Globally Unique Identifier of the campaign (= String of 36 characters, divided by 4 hyphens, specific per campaign) |
channel_guid | 64E87575-1D90-41B3-8171-C151D21C251F | Globally Unique Identifier of the channel (= String of 36 characters, divided by 4 hyphens, specific per channel) |
parentURL | https://qualifio.com/catalogue/ | URL of the page containing the campaign |
domain | qualifioshowcases.qualifioapp.com | Sub-domain of the campaign |
device | desktop | Device used by the participant (values = mobile, tablet, desktop) |
lg | fr | Language of the campaign |
pg | 1 | Page in the global flow of the campaign (eg: Welcome screen = 1, 1st question = 2, 2nd question =3, Identity = 4...etc.) |
step | intro | Name of the step the user is in (eg: intro = welcome screen, questions = questionnaire, identityset = form, exit = exit screen) |
pgi | 1 | Internal page of the game flow (eg: Question 2 = 2, although it can be the third screen) |
page_path | /720104/fr/1/intro/1 | Path of the page of the user (replacing data from the session) Standard path is: /campaign_id/lg/pg/step/pgi |
form_submitted | 0 | The form has been validated (value=1) or not (value=0) |
optins | [1222,7997] | The list of the IDs of the checked optins. |
isIdentified | 1 | Is this an identified (value=1) or unidentified (value=0) campaign |
isWinner | null | Did the participant win (value=1), lose (value=0) or is not known yet (value=Null). |
preview | TRUE | You are testing a campaign in preview mode |
query_string | &utm_source=newsletter | URL parameters of the page containing the campaign |
score | 5 | Score obtained by the participant |
thematics | [{"code": "spo","description": "Sport"}] | A key value structure for thematics associated to your campaign |
timeClient | 15 | Timing on the client/browser side |
Access the keys
qlfDatalayer
is a Json object stored at the first position of an Array.
Scope
qlfDatalayer
is only available in the campaign's iframe, therefore it can't be used in a Tag of a minisite template.
var pagePath = qlfDataLayer[0].pagePath;
var campaignLanguage = qlfDataLayer[0].lg;
var campaignTitle = qlfDataLayer[0].title;
var myVirtualPath = qlfDataLayer[0].lg + '/' + qlfDataLayer[0].id + '/' + qlfDataLayer[0].step;