matelso DataLayer

Search & Replace Script

Within this article we check out the matelso datalayer and how to use it.

What is the matelso datalayer?

This feature allows you to insert data from your website into the matelso-system and use it later.


How to insert data into the datalayer?

As soon as the matelso snippet is embedded within your website, you can insert data into the datalayer. The matelso datalayer takes an javascript object as parameter. In this object you can access the top level properties. If this object contains child objects or arrays those can not be accessed.

If you want to transfer objects or arrays then you can send them as JSON or unwrap the object.


The following snippet inserts data into the matelso datalayer:

if(mtls.loaded) {
window[window.CallTrackingObject]("addCustomTrackingValues", { prop1: 'wert1', prop2: 15, prop3: '{}' });
}

In the first line of this snippet we open an "if" block to check whether the matelso S&R library is loaded and ready. This block will be closed in line 3.

In line 2 we send an object "{ prop1: 'wert1', prop2: 15, prop3: '{}' }" in the matelso datalayer. This object contains 3 properties (prop1,prop2,prop3). 



How to use data from the datalayer?

Daten im matelso DataLayer können überall dort verwendet werden, wo auf das DDD zugegriffen werden kann. Das beinhaltet Integrations 2.0 und das Call Messaging (2.0). Der DDD Key für den DataLayer beginnt mit "webData.custom" und darauf folgt der Eigenschaftenname prop1/2/3 "webData.custom.prop1".
Auf diesen Key folgt dann eine Attribution und wenn gewünscht ein Modifier.


Beispiel ohne Modifier: webData.custom.prop1.attribution(LASTNOTEMPTY)
Beispiel mit Modifier: webData.custom.prop1.attribution(LASTNOTEMPTY).fallBackValue(leer)