Debug Module
In our generic tag warning, logs and error messages that were displayed by default in browser console have been removed for more clarity and to avoid confusion between AB Tasty logs and other logs.
However, logs can be useful to understand what is happenning in case of issue so using debug module could help.
The following documentation explains how to activate or deactivate the debug module.
Modes for the module
-
Default mode: the debug module is deactivated and logs nothing in the console (default behaviour).
-
Simple mode: the debug module is activated and logs
info
,error
,warning
andsuccess
logs.
Using the debug module
To activate the debug module there are 2 different methods:
- using a cookie named
abTastyDebug
with a value equal totrue
. This method allows you to activate the debug module on all pages until the cookie is removed. The page needs to be refreshed in order to detect the cookie.
Creating the cookie:
document.cookie="abTastyDebug=true;path=/;";
Removing the cookie:
document.cookie="abTastyDebug=true;path=/;expires=Thu, 01 Jan 1970 00:00:00 GMT;";
- using a global variable named
abTastyDebug
with a value equal totrue
. This method allows you to activate the debug module on the current page until a refresh or a page change.
Creating the variable:
window.abTastyDebug = true;
Removing the variable:
delete window.abTastyDebug;
Using the appropriate log level
The debug module should be activated to make the logs work.
There are 4 log levels: error
, warn
, info
and verbose
/debug
The verbose log level is logging more information into the console. However, keep in mind that minor importance verbose information might mess the console window up.
Here how to chose the correct log level in the different browsers:
Chrome:
Firefox:
Safari:
Pause the debug module
Once the debug module is activated, it is going to log everything. But what about the case you only want to log the initialization of the tag? We are providing a method to pause the debug module so it stops the logs while keeping the tag running.
You can use the following method:
- using a global variable named
abTastyStopLog
with a value equal totrue
. This method allows you to stop the logs from the debug module on the current page until a refresh or a page change.
Creating the variable:
window.abTastyStopLog = true;
Removing the variable:
delete window.abTastyStopLog;