Expand my Community achievements bar.

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

logging with a data element (custom js)

Avatar

Level 1

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?

1 Accepted Solution

Avatar

Correct answer by
Level 2

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. 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

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.