logging with a data element (custom js) | Community
Skip to main content
November 26, 2019
Solved

logging with a data element (custom js)

  • November 26, 2019
  • 1 reply
  • 3137 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AnalyticsAlice

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. 

1 reply

AnalyticsAlice
AnalyticsAliceAccepted solution
Level 2
December 4, 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.