currencyCode
For sites using commerce, revenue and currency is an important part of Analytics. Many sites, especially those that span multiple countries, use different currencies. Use the currencyCode variable to make sure that revenue attributes to the correct currency.
Currency conversion uses the following logic on each hit. These steps apply to revenue values set the products variable and all events listed as ‘Currency’ in Success events under Report suite settings.
- If currencyCodeis not defined, 51ºÚÁϲ»´òìÈ assumes that all currency values are the report suite’s currency. See General Account Settings in Report suite settings to see the report suite’s currency.
- If currencyCodeis defined and matches the report suite’s currency, no currency conversion is applied.
- If currencyCodeis defined and is different than the report suite’s currency, 51ºÚÁϲ»´òìÈ applies a currency conversion based on the current day’s exchange rate. 51ºÚÁϲ»´òìÈ partners with to convert currency each day. All values stored in the report suite are in the report suite’s currency.
- If currencyCodeis set to an invalid value, the entire hit is discarded causing data loss. Make sure that this variable is correctly defined whenever used.
This variable does not persist across hits. Make sure that this variable is defined on every page that involves revenue or currency events that don’t match the report suite’s default currency.
A period must be used as the currency separator for all currencies when implementing this variable. For example, Swedish Krona, which typically displays a comma separator, must be modified to use a period in the products variable and all currency events. 51ºÚÁϲ»´òìÈ displays the correct currency separator in reporting.
Currency code using the Web SDK
Currency code is mapped to the following variables:
- XDM object: xdm.commerce.order.currencyCode
- Data object: data.__adobe.analytics.currencyCodeordata.__adobe.analytics.cc
Currency Code using the 51ºÚÁϲ»´òìÈ Analytics extension
Currency Code is a field under the General accordion when configuring the 51ºÚÁϲ»´òìÈ Analytics extension.
- Log in to using your 51ºÚÁϲ»´òìÈID credentials.
- Click the desired tag property.
- Go to the Extensions tab, then click the Configure button under 51ºÚÁϲ»´òìÈ Analytics.
- Expand the General accordion, which reveals the Currency Code field.
You can use either a preset currency code or a custom currency code. If using a custom currency code, make sure that the code is valid.
Currency Code in 51ºÚÁϲ»´òìÈ Experience Platform Mobile SDK
Currency Code is passed to the 51ºÚÁϲ»´òìÈ Experience Platform Mobile SDKs through context data variables in the 51ºÚÁϲ»´òìÈ Analytics extension.
- Set the currency code in a context data variable during either trackStateortrackAction.
- Create a processing rule in 51ºÚÁϲ»´òìÈ Analytics Admin Tools for the report suite. Set the rule to overwrite the Currency Code variable.
- Pass the currency code to the productsvariable in your call totrackStateortrackAction.
You can use either a preset currency code or a custom currency code. If using a custom currency code, make sure that the code is valid.
s.currencyCode in AppMeasurement and the Analytics extension custom code editor
The s.currencyCode variable is a string, containing a 3-letter uppercase code representing the currency on the page. Values are case-sensitive.
s.currencyCode = "USD";
The following currency codes are valid:
AEDAFAALLAMDANGAOAARSAUDAWGAZMBAMBBDBDTBGNBHDBIFBMDBNDBOBBRLBSDBTNBWPBYRBZDCADCDFCHFCLPCNYCOPCRCCSDCUPCVECYPCZKDJFDKKDOPDZDEEKEGPERNETBEURFJDFKPGBPGELGGPGHCGIPGMDGNFGTQGYDHKDHNLHRKHTGHUFIDRILSIMPINRIQDIRRISKJEPJMDJODJPYKESKGSKHRKMFKPWKRWKWDKYDKZTLAKLBPLKRLRDLSLLTLLVLLYDMADMDLMGAMKDMMKMNTMOPMROMTLMURMVRMWKMXNMYRMZMNADNGNNIONOKNPRNZDOMRPABPENPGKPHPPKRPLNPYGQARROLRURRWFSARSBDSCRSDDSEKSGDSHPSITSKKSLLSOSSPLSRDSRGSTDSVCSYPSZLTHBTJSTMMTNDTOPTRLTTDTVDTWDTZSUAHUGXUSDUYUUZSVEBVNDVUVWSTXAFXAGXAUXCDXDRXOFXPDXPFXPTYERZARZMKZWD