Saturday 18 March 2017

Debugging Adobe Dynamic Tag Management (DTM)

Adobe Analytics is a powerful tool to analyse almost anything that can be tracked on a website. Unfortunately, any additional, customised code and feature increases the risk of introducing bugs as well.

Setting up the debugging environment

We already briefly discussed the advantages of DTM and how to include it into a digital marketing platform in a prior article on our blog. Once DTM is set up and all the necessary rules that help tracking the right data are defined, the fun begins: Seeing them in action. When testing if everything works the way it should two things need to be considered:
  1. The rule is firing successfully
  2. The variables are mapped correctly
In order to properly manage to monitor this you need a packet analyser (or network analyser). Don't get intimidated though, you have one installed already, and you love to watch youtube with it.
Yes, your browser most surely has a packet analyser already built in. It's normally the "network" tab of the “web console” or “developer tools” of your preferred browser. The name changes from one browser to another, but you should be able to find it in the browser's options. Also, there are some add-ons and plug-ins that can also do the same thing.
For simplicity I'll stick with Google Chrome's console (which you can bring up by hitting F12 on a PC, or ⌥⌘j on a Mac), and the Adobe Marketing Cloud Debugger plugin. Follow the instructions on Adobe's website to set everything up correctly.

Enough with the tools, let's start debugging

To make things a bit more visual lets think of an example: you set a “Page Load Rule” with a condition to fire for all pages that contain the word “marketing” in the URL. Now, you load the specific page, and want to know if your rule fired or not. You have a couple of ways of knowing this:
First approach to see if a rule fired:
Set at least one variable in the “Adobe Analytics” section of the DTM rule; for example the Page Name. Now go to the Chrome's console, and in the “network” tab, look for a request to the Adobe Analytics servers. Pro tip: all request to Adobe Analytics have “/ss/” in the URL, so you can filter these out with the search function. 

Setting the Page Name Variable in DTM
Filtering out Adobe Analytics requests in Google Developer Tools

The image above shows that the rule fired successfully. Now, you can click on the result, see the contents of it, and confirm that the pageName came through as you set it.
For better usability you can use the "Adobe Marketing Cloud Debugger". It shows the content of the requests in a better and easier to read way. This is how our request looks like on the debugger tool:

Using the Adobe Marketing Debugger Tool to see if a rule is fired

By looking at the request on the debugger, you can easily confirm that your variables are mapped correctly, too. In this case we are only setting page name, but of course here you can also check your evars, props, events and other system or configuration variables.
If you want to use DTM for any tool other than Adobe Analytics, you can still check if the rule fired successfully using the method we described above. But to control if the variables were mapped correctly and a more in depth analysis you should get some advice on how to debug that specific tool that you are using.
The quick check to see if a rule is fired:
Another very simple hack to see if a rule is fired or not is using Javascript. You can add a short script to your DTM rule that will inform you once a rule is fired. Simply go to the “Javascript / Third Party Tags” section of the DTM rule and add a very simple new script: console.log(“Marketing Page Rule Fired”);

Adding JavaScript to a DTM rule
Adding the right script to display notifications in the browser console

“Console logs” are vastly used for debugging code. All they do is to display anything you want in your browser console. In this case we only want it to display the text “Marketing Page Rule Fired” as soon as the rule is triggered. If the rule fires, you will see something like below on your console:

Seeing the page rule fired in the browser's console

 Making Adobe DTM work
Now you know how to debug your rules and confirm that your variables are mapped correctly. As mentioned above, the same thing can be achieved with several other tools, like the Firefox's console, firebug + omnibug, Httpfox, or other browsers' consoles.
Do you use any other debugging methods? Let us know in the comments!

No comments :

Post a Comment