Website dataLayer

Create custom parameters in Digital for customers who use Adobe, Google Tag Manager (GTM), or Analytics products to present or manage the metadata that is specific to their business or users. These products often use a JavaScript array object called a dataLayer. To map an item in the dataLayer array to a Digital custom parameter you need the numerical index of the item in the array.

Important: This technique can only be used for a JavaScript array with a numerical index. If the JavaScript array was created as an associative array (i.e. not using a numerical index), this technique does not work. Only numerical indexes are supported. See your JavaScript developer for assistance with making data available in a supported array or standard JavaScript variable.

To identify the dataLayer object in the browser and find the index of an item:

  1. Open the web page you want to check in a web browser. Then open the inspect feature in the developer console.

    Note: The steps to open the developer console are slightly different for each browser. In Chrome, right-click the web page you want to inspect and select Inspect > Developer Console.
  2. Select the Console menu item and search for "dataLayer". As you type, your browser displays autocomplete options. Select dataLayer.

    Searching for "dataLayer".

  3. Hit Enter to generate the array.

    Abbreviations generated.

  4. Click the down arrow to the left of the array to view all objects within it. Make a note of the number (array index) that contains the data you want to capture as part of the survey feedback item. This is required when creating the custom parameter.

    Array-based options.

  5. Log in to Medallia for Digital (see Getting started for details on logging in).

  6. In Custom Parameters, click Add New.

    Adding a custom parameter.

    Configure the custom parameter as follows:
    • Parameter Name — Internal name that is displayed in reports and in the inbox. Assign a parameter name that is easily recognizable by customers (i.e., 'loggedIn').

    • Parameter Type — Select the data type of the parameter you are going to collect (i.e., text, number, boolean, date, time). Unless you intend on performing mathematical comparisons (i.e., greater than, smaller than), always select Text.

    • Origin Type — Select Var for Variable.

    • Origin Name — Because this is an array, the syntax required is dictated by the structure of the array. Typically, it looks like dataLayer.X.parameter where X is the index number of the item in the array, and parameter is the name of the item. Based on the dataLayer array shown in step 4, to use the parameter name 'loggedIn', enter dataLayer.0.loggedIn as the Origin Name.

    • Attach Forms — Select the survey to which the custom parameter applies.

    For more information, see Setting up custom parameters.

  7. Test the parameter in a QA environment.
  8. Go to your inbox and confirm that the value appears in the Feedback Item section.

    Verifying the value.