Debugging Helpers

Trying to troubleshoot Adobe Marketing Cloud solutions? Have no access to plugins? Don’t despair!

Below you’ll find a handy collection of code snippets that you can paste into your browser’s console and execute.

Hint: triple-clicking into the boxes should select the whole snippet.

DTM

Find out whether DTM is loaded, in staging mode or not, at what time your library was last built, and with which version of DTM:

if("object"!=typeof _satellite)console.log("No Adobe DTM JS library loaded");else{var a=_satellite,b="Adobe DTM JS library is present";"undefined"!=typeof a.settings&&a.settings&&"undefined"!=typeof a.settings.isStaging&&a.settings.isStaging&&(b+=" (staging library)"),"undefined"!=typeof a.appVersion&&a.appVersion&&(b+=" version "+a.appVersion),"undefined"!=typeof a.buildDate&&a.buildDate&&(b+=", latest build "+a.buildDate),console.log(b)}

This is what you’ll see:

[screenshot]
Chrome – a page w/o DTM
[screenshot]
Edge – a page with DTM
[screenshot]
Firefox – a page with DTM staging library

Marketing Cloud ID Service

Find out whether the Marketing Cloud ID Service library is loaded, and which version you are using:

Note: this works for Marketing Cloud ID Service version 2 and up. Before that, the “version”property was not exposed like this. If your page uses a “visitor” variable, the snippet will work, too.

"function"!=typeof Visitor?console.log("Adobe Marketing Cloud ID Service JS library not loaded"):"undefined"!=typeof Visitor.version?console.log("Adobe Marketing Cloud ID Service JS library version "+Visitor.version):"undefined"!=typeof visitor&&visitor&&"undefined"!=typeof visitor.version&&visitor.version?console.log("Adobe Marketing Cloud ID Service JS library version "+visitor.version):console.log("Not sure whether Adobe Marketing Cloud ID Service JS library is present");

This is what you will see:

[screenshot]
Chrome – a page w/o Marketing Cloud ID Service
[screenshot]
Edge – a page with Marketing Cloud ID Service library loaded

Analytics

Find out whether the Analytics library is loaded, what type you use (s_code.js or AppMeasurement.js), and which version:

"function"!=typeof AppMeasurement&&"object"!=typeof s?console.log("No Adobe Analytics JS library loaded"):"function"==typeof AppMeasurement?console.log("Adobe Analytics JS library version "+(new AppMeasurement).version):"object"==typeof s&&"undefined"!=typeof s._c&&"s_c"==s._c?console.log("Adobe Analytics legacy JS library version "+s.version):console.log("not sure whether Adobe Analytics JS library is present");

This is what you’ll see:

[screenshot]
Chrome – a page w/o Analytics
[screenshot]
Firefox – a page with legacy H.xx.y Analytics
[screenshot]
Edge – a page with Analytics

Target

Find out whether the Target library is being loaded, which type you are using (mbox.js or at.js), and which version:

"undefined"!=typeof mboxVersion||"undefined"!=typeof adobe&&"undefined"!=typeof adobe.target?"undefined"!=typeof mboxVersion?console.log("Adobe Target legacy JS library version "+mboxVersion):"undefined"!=typeof adobe&&adobe&&"undefined"!=typeof adobe.target&&adobe.target&&"undefined"!==adobe.target.VERSION&&adobe.target.VERSION?console.log("Adobe Target JS library version "+adobe.target.VERSION):console.log("not sure whether Adobe Target JS library is present"):console.log("No Adobe Target JS library loaded");

This is what you’ll get:

[screenshot]
Chrome – a page w/o Target
[screenshot]
Edge – a page with legacy Target library (mbox.js)
[screenshot]
Firefox – a page with Target library (at.js)

Audience Manager

Find out whether Audience Manager is loaded in the page, and which version (DIL code or AppMeasurement Module):

if("function"===typeof DIL){if("function"===typeof AppMeasurement_Module_AudienceManagement){console.log("Adobe Audience Manager (Module) version "+DIL.version);}else if("undefined"!==typeof s_c_il){for(var i=s_c_il.length-1;i>=0;i--){var candidate=s_c_il[i];if("undefined"!==candidate&&candidate&&"undefined"!==candidate._c&&candidate._c&&"s_m"===candidate._c){if("undefined"!==typeof candidate._n&&candidate._n&&"DIL"===candidate._n){console.log("Adobe Audience Manager (DIL code) version "+DIL.version);break;}}}}else{console.log("Unable to determine type of Adobe Audience Manager, version " + DIL.version);}}else{console.log("No Adobe Audience Manager JS present")}

This is what you’ll see:

[screenshot]
Chrome – a page w/o Audience Manager
[screenshot]
Firefox – a page with Audience Manager DIL code
[screenshot]
Edge – a page with Audience Manager AppMeasurement Module

Notes

These snippets can be used in almost any browser, and you don’t need any plugins, either.

For more resources around debugging, I would recommend the related article on this blog, Debugging, or the new installment, Debugging 2017.02.

I also made the Inofficial Adobe Marketing Cloud Debugging Cheat Sheet (PDF letter version), also available as an A4 version, which you can put up onto your wall:

[screenshot]
Inofficial Adobe Marketing Cloud Debugging Cheat Sheet