1. Knowledge Base
  2. Search & Replace Script

matelso DataLayer

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: 'val1', 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?

You can access the data from the datalayer everywhere you can use DDD keys. This includes integrations 2.0 and call messaging (2.0).

The DDD key for this starts with "webData.custom". Following this prefix you add the property name prop1/2/3 "webData.custom.prop1".

After this key you have to add the attribution and in case this is requested the modifier.

Example without modifier: webData.custom.prop1.attribution(LASTNOTEMPTY)

Example with modifier: webData.custom.prop1.attribution(LASTNOTEMPTY).fallBackValue(empty)