setBackupCurrency()
is used to set a currency that will be used for any event that requires currency but none is provided.
This will apply to the following events:
product-view (trackPdp(), trackProductView())
product-add (trackPdp(), trackProductAdd())
product-purchase (trackPurchase())
This should not be used as the primary way to track currencies. It should only be used as a backup or fallback incase there was an error when passing in currency the correct way.
Syntax
setBackupCurrency(currency);
Parameters
currency
type: string
(currency code)
description: The currency code that will be used when purchasing the PDP’s product. Make sure it is a three letter currency code in the format of 'USD'
, 'EUR'
, 'JPY'
, etc.
Return Value
This function has no return value.
Examples
Set backup currency to ‘USD’
In this example we are setting the backup currency to 'USD'. That way if there is any error with the other tracking events that causes the currency to be undefined, it will have a fallback to USD.
// Import the integration from the 'installation' step
import { integration } from './xgenSdkIntegration';
// Set backup currency
integration.setBackupCurrency('USD');