Three quick tips for validating your Adobe DTM Implementation in real time


It's a no-brainer that validation plays a critical role with any tag management implementation. In addition to checking the analytics variables for data accuracy on a page load or link click, it is equally important to test that your code and tag rules execute at the right time and in the right order. While there are many tools available to help in this process I wanted to share a few ways you can leverage the browser console to help you with validation in real-time.

Use the “debug” mode in the DTM Switch

Much like the Adobe Debugger can help you see the output of an image request as the page loads, the DTM Switch is a Google Chrome or Firefox extension that can be added directly to the browser. Using the “debug” mode will send DTM activity directly to the console. This tool is a must have for any DTM implementation because it will show you exactly what your scripts are doing as the page loads or event activity happens.

image
You will see the DTM Switch icon appear in the browser at the top right on any page where the DTM header script is active

image DTM Switch extension for Google
DTM Switch extension for Firefox

What’s great about this little utility is it’s built in debugging feature. This allows you to see in the browser console exactly when your rules are executed by DTM.

And combined with the script runtime data of the console itself, the debug mode of the DTM switch can also help you troubleshoot the source of problems that may happen during the implementation process.

Send your DTM script output directly to the browser console

Because each implementation is custom to some degree, this probably means you will write scripts or functions to perform certain tasks that you'd like to validate in real time. Some example use cases might include:

  • You have custom Javascript code that dynamically switches the report suite ID based on URL and you need to validate the dynamic output as the page loads.
  • You have deployed a data layer in a JSON object on the page and need a quick way to validate elements without viewing the page source.

Until recently, using "console.log" was a very convenient way to send this data to the console. The downside to using this method is it does not work the same in all browsers and may throw errors or affect the user experience - specifically in Internet Explorer.

Fortunately, DTM has a built-in function called _satellite.notify() that serves a similar purpose as console.log and is cross-browser compatible.

This function requires 2 parameters and can be called as part of any script you deploy in DTM.

Function Reference

_satellite.notify(text_value,intensity_scale)

image
Example: Custom Adobe Analytics Code. Note that the default value for intensity scale is 1 but can go as high as 5

Now when the script runs that contains the call to _satellite.notify( ) it will push the text directly to the console.

image

Call _satellite.notify using a global wrapper function

If you're like me, you'll frequently want to send the output from your scripts to the console for validation and I could certainly call _satellite.notify() every single time to do that. However, I'm not a big fan of typing the same functions and parameters over and over in multiple tags if I don't have to.

One way I create code efficiency when it comes to validation is to create a single function that can be deployed as part of a global page load rule at the top of the page and can then be referenced at any time by other page rules.

For example, with most of my implementations I deploy a "Global Functions" page load rule that executes at the top of the page. This rule contains code and functions I use regularly, including a function I use for validation called dtm_notify().

dtm_notify() is simply a wrapper that sends the text parameter back to _satellite.notify().

Here's the function:

function dtm_notify(text)
{
    _satellite.notify(text,1);
    return true;  
}  

And now with this function deployed as part of a global rule, I can call it at any time to send script validation notes to the browser console and I don't have to call the long version with multiple parameters each time.

image image
Example: Calling dtm_notify using Custom Adobe Analytics Code

Conclusion:

Validating your scripts and tag rules is critical to any DTM implementation. It’s great to have a few simple tools and tricks to make the process easy and efficient in real time.


About Search Discovery

Search Discovery is a digital intelligence company that empowers organizations to make better, dynamic and transformative business decisions. We're focused on delivering results for our clients through digital analytics, SEO, digital media, and technology.


Comments

Let's Talk.

You're excited. We're excited. Give us a shout so we can get this party started.

!
!