Highlighted

can't able to assign 0 to Data Element in DTM

Avatar

Avatar

rajarajanr71853

Avatar

rajarajanr71853

rajarajanr71853

15-10-2015

Hi,

    I tried to get the zero (0) from data layer to DTM Data Element using JS object. But the Data Element is assigning the default value instead of zero(0). And I checked my Data Layer object with JS alert, its working fine. I dont know where it went wrong.

Eg: var dlayer.count = 0; - datalayer object 


Kindly Help Me
Urgent 

Thank you in advance

Replies

Highlighted

Avatar

Avatar

TanmayMathur

Employee

Total Posts

1.2K

Likes

241

Correct Answer

421

Avatar

TanmayMathur

Employee

Total Posts

1.2K

Likes

241

Correct Answer

421
TanmayMathur
Employee

15-10-2015

Hi,

You can try putting the 0 in double quotes which will specify it as a string. The number 0 would specify it as an empty string instead.

Here is a related article as well - http://stackoverflow.com/questions/7615214/in-javascript-why-is-0-equal-to-false-but-when-tested-by-...

Let me know if that works.

TM

Highlighted

Avatar

Avatar

rajarajanr71853

Avatar

rajarajanr71853

rajarajanr71853

15-10-2015

Hi,

Thank you. Its working fine.
But whenever I try to map Data Elements with Page Load Rule Condition I am getting the below mismatch Rule not met.

SATELLITE: Condition function (){return _satellite.textMatch(_satellite.getVar("Count"),/^[0]$/i)} for rule "count" not met.

 

And its working fine if i call the function manually. But the Rule is not fired. Please see the below snippet.

_satellite.getVar("Count")

"0"
_satellite.textMatch(_satellite.getVar("Count"),/^[0]$/i)
true

Kindly Help me.
Thank you .
Highlighted

Avatar

Avatar

rajarajanr71853

Avatar

rajarajanr71853

rajarajanr71853

15-10-2015

Hi TanmayM
            A gentle reminder . Kindly Help Me on the above Issue (Urgent).
Thank you in advance.
Rajan