Expand my Community achievements bar.

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

Avatar

Level 2

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

3 Replies

Avatar

Level 10

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

Avatar

Level 2

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 .

Avatar

Level 2

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