Expand my Community achievements bar.

SOLVED

How do I capture boolean values from JS varible

Avatar

Level 2

I have a data element that is using JavaScript variable name to get a value. The values are boolean.

Is it the case that this field can only return string values? It seems that anytime i try to capture a boolean, the data doesn't appear in the analyics debugger.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi kshafer42,

Yes, your observation is 100% accurate. The false value will not get populated if set as a reference to a Data Element.

As you already may guess, you can make a transition from boolean to string to make it working. For example, you can create another Data Element that will be mapped to the primary "boolean" Data Element with some JS code that will make the trick.

View solution in original post

2 Replies

Avatar

Level 2

FUN FACT: if the variable returns "false" it doesn't return any value. Boolean only seems to work if the result it true. Thoughts?

Avatar

Correct answer by
Level 10

Hi kshafer42,

Yes, your observation is 100% accurate. The false value will not get populated if set as a reference to a Data Element.

As you already may guess, you can make a transition from boolean to string to make it working. For example, you can create another Data Element that will be mapped to the primary "boolean" Data Element with some JS code that will make the trick.