GTM template variable to validate dataLayer

Validation data is one of the most important steps in the process of creating a robust, accurate, and reliable data collection pipeline. Validating the Data Layer for incomplete property values is a common task

Task

GTM Custom Template Variable to validate the quality of dataLayer that will return the keys (in GTM notation) for all values that are null, undefined, or empty strings. Otherwise, the template should return false.

Solution

To import a template:

  1. In Tag Manager, click Templates.
  2. Click New. This will open a blank template in the Template Editor.
  3. Click the More Actions menu (more_vert) and select Import.
  4. Select the .tpl file that you would like to import Source code

Use cases

Create tag with template variable alt text

Run debuging mode alt text

Check value of variable

alt text

Send test event and see the results alt text

References