Convert a string in the dataLayer to a number when saving to an eVar

philipk92120636

13-06-2019

Probably a super simple one this.

 

Basically, I'm saving the price difference between two products.

 

In the dataLayer it's a string but it would be handy to save this as a number so I can use it for metrics.

 

How can I convert the value and save it to an eVar? I've tried the below, but it does absolutely nothing!

 

var priceDifference = _satellite.getVar("priceDifference");

if(priceDifference) {

    s.eVar77 = parseFloat(priceDifference);

}

View Entire Topic