--- title: "setBackupCurrency()" slug: "setbackupcurrency" updated: 2024-07-26T14:47:03Z published: 2024-07-26T14:47:03Z canonical: "docs.xgen.ai/setbackupcurrency" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.xgen.ai/llms.txt > Use this file to discover all available pages before exploring further. # setBackupCurrency() `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()](/v1/docs/trackpdp), [trackProductView()](/v1/docs/trackproductview)) - product-add ([trackPdp()](/v1/docs/trackpdp), [trackProductAdd()](/v1/docs/trackproductadd)) - product-purchase ([trackPurchase()](/v1/docs/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 ```javascript 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. ```javascript // Import the integration from the 'installation' step import { integration } from './xgenSdkIntegration'; // Set backup currency integration.setBackupCurrency('USD'); ```