Troubleshooting Data Elements in DTM
Troubleshooting Data Elements can be tricky as there could be multiple causes. This step by step guide is a helpful reference when troubleshooting data elements that are not populating. Data elements can be used in most of the UI fields in DTM.
Creating Data Elements
To create a data element, navigate to Rules > Data Element > Create New. Once the data element has been added, the following syntax can be used in a rule or tool to call the data element.
In the following example, %page_name% is a custom script data element that is being added to a page load rule.
For more information on creating data elements, the documentation is available here.
Testing Data Elements
Before adding a data element to a rule, test that the expected value returns on the page. To test the data element is working, do the following:
- Navigate to a page where the data element is available on the site.
- Open the web console and type in _satellite.getVar(‘dataelementname’) and hit enter. This code returns any value that is present for the noted data element on that page.
- If the data element is working correctly, then the value is defined.
- If the value is undefined, then the data element is likely setup incorrectly. Check the custom script for syntax errors.
- If the value is null, then that data element does not have a value on that particular page. Try testing on another page before altering the data element setup.
- If there is an error '_satellite is not defined', there is a scoping issue. In order for '_satellite.getVar()' to have access to the global _satellite object, check the box 'execute globally' in the script editor.
Troubleshooting Data Elements
If the data element has a value when tested, but doesn't fire with the rule one of the following could be a problem:
- Setup - The data element can't retrieve the value of a custom script until it is called by a rule or tool within DTM. Check that the data element is called within a rule or tool.
- Timing - Check and see where the rule is loading in the rule condition. If it’s loading at Top of Page or Onload, then the data element is likely not available on the page yet when the rule fires. Try switching the rule to load at Bottom of Page or DOM Ready so the data element has more time to populate before the rules fires.
- Syntax Errors - Check the rule for syntax errors.