logging with a data element (custom js)

Avatar

Avatar
Level 1
forward3d-dsaa
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
forward3d-dsaa
Level 1

Likes

0 likes

Total Posts

3 posts

Correct reply

0 solutions
View profile
forward3d-dsaa
Level 1

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
Give Back
Level 2
AnalyticsAlice
Level 2

Likes

10 likes

Total Posts

10 posts

Correct reply

7 solutions
Top badges earned
Give Back
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Give Back
Level 2
AnalyticsAlice
Level 2

Likes

10 likes

Total Posts

10 posts

Correct reply

7 solutions
Top badges earned
Give Back
Boost 5
Boost 3
Boost 10
Boost 1
View profile
AnalyticsAlice
Level 2

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)