The EM.context is a data structure that has all the relevant data in the iFrame where the externalized module is implemented. The EM.context can be used to create some custom dataLayer objects required by some TMSs like Tealium and Adobe.

All the available parameters of the EM dataLayer can be found in the following link:

How to find the EM.context

To find the EM.context in the iFrame go to the URL where the externalized module is placed and open ‘Console’ from Google Developer Tools.

In ‘Console’ access the iFrame using the ‘JavaScript context’:

Once the iFrame has been accessed, type ‘EM.context’:

Creating a new dataLayer object using the EM.context

For this example, we will use the EM.contect to populate Tealium’s utag_data object.

1. Identify the parameters needed in the script

The parameters that will use JavaScript will be those that need dynamic values. For example:

The variables in the EM.context can be accessed using JavaScript paths:

2. Use JavaScript to map the parameters from the EM.context

3. Insert the JavaScript paths to the TMS dataLayer object

Add the JavaScript paths to the corresponding variables:

The same principles can be applied to any kind of data structure.

Once this is done, your custom dataLayer is ready to be published!