Is there any way to convert dollar/cents values to just cents?

Silver Contributor
Silver Contributor
As an example, we are passing a value of "79.95" on a conversion pixel when the vendor is expecting a value of "7995". Is there any way to make this conversion in Tealium before or will we need to have our commerce provider make the change on their end?
5 REPLIES 5

Is there any way to convert dollar/cents values to just cents?

Moderator
Moderator
Hi Jason, Assuming you're using the ecommerce extension in Tealium, you could do the following: * Create a "Set Data Values" extension and scope it to the tag in question * Give it a name of your choice * Select the data source as _csubtotal from the drop down list on the left hand side * In "type" select "JS Code" * Enter the following javascript code: b._csubtotal*100; And you're done. The subtotal will now be multiplied by 100, giving you the correct value, but crucially only for this particular tag - all other tags continue to receive 79.95.
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Is there any way to convert dollar/cents values to just cents?

Moderator
Moderator
I should add, if you're manually mapping the price and it's not in the ecommerce extension, the same principle applies - just substitute _csubtotal for your data source name i.e. instead of b._csubtotal change to b.my_price_datasource
Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Is there any way to convert dollar/cents values to just cents?

Employee Emeritus
You could add a Javascript Code extension scoped to the tag you need the conversion for and then do: b.order_total = b.order_total * 100; You would need to do that for each UDO item that needed to be converted.

Is there any way to convert dollar/cents values to just cents?

Employee Emeritus
Just to expand a bit on Craig's great answer, if you are trying to do a product level values in addition, like product level prices or discounts, it can be a little more complicated if you are not familiar with looping through arrays. If you don't feel comfortable doing this, please contact your account manager so we can help you with this.

Is there any way to convert dollar/cents values to just cents?

Silver Contributor
Silver Contributor
Thanks everyone for the help!
Public