Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

logging with a data element (custom js)

forward3d-dsaa
Level 1
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
AnalyticsAlice
Correct answer by
Level 2
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

0 Replies
AnalyticsAlice
Correct answer by
Level 2
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