the only reason the \n is there at all is to produce prettier html
Or a prettier JavaScript object literal by the looks in this case. Although I think I'd still favour the "prettier" originating source code to be honest.
echo 'ecomm_totalvalue: parseFloat(\'' . $this->page_totalvalue . '\')' . "\n";
If I think I know what you are trying to do then this is not going to work. If $this->page_totalvalue returns strings like "1,750.00" (as mentioned above) then ecomm_totalvalue is going to end up with the value 1 (one). That comma is a problem. (But you're not going to realise that until further down the line... when the code that receives this object outputs the wrong values - if indeed you realise the values are wrong! This could be difficult to debug. You are better off doing the conversion in PHP.)
This PHP object should really be providing direct access to the numeric value of "page_totalvalue"? In order to get the formatted string (above), it is already processing the numeric value (possibly according to a locale?). It is not good to have to convert a formatted numeric string back into a floating point number. Because of the number of different ways a float could be formatted (in different locales) this is prone to error.
If you have no option, and thousand separators are always commas then try something like:
echo 'ecomm_totalvalue: ' . str_replace(',','',$this->page_totalvalue) . "\n";
The above code simply removes the thousands separator, so JavaScript will see it as a numeric value (and not an error as you probably had originally).