logging with a data element (custom js)

Avatar

Avatar

forward3d-dsaa

Avatar

forward3d-dsaa

forward3d-dsaa

26-11-2019

Hi,

I am console.logging using a data element and the debug mode on the development staging.

in the data element called "test"

I have tried the following:

1.

console.log("hello"); it did not output anything

2.

var hello=console.log("hello");

return hello;      it did not output anything

3.

_satellite.Logger.log("hello"); it did not output anything

However, when i run in the console while using DTM SWITCH: _satellite.getVar("test")  it does output.

Is that something that i m missing?

Why is the data element not outputting anything on the console?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

AnalyticsAlice

Avatar

AnalyticsAlice

AnalyticsAlice

04-12-2019

Your data element needs to be called from somewhere, such as a rule or extension, in order to output the message. This is why you don't see anything automatically when you load a page even though there is nothing syntactically wrong with your code. As this guide explains, a data element's value will attempt to be reset any time it is called:  https://jimalytics.com/tag-management/adobe-launch-data-elements-guide/

Also, If you must to log messages to the console, it is recommended to always use the _satellite.logger.log syntax since console.log is not compatible on every browser and has the potential to throw errors. 

Answers (0)