Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

rajarajanr71853
Level 2
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
TanmayMathur
Level 10
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

rajarajanr71853
Level 2
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 .
rajarajanr71853
Level 2
Level 2

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