All Collections
Get Started
Guides
Advanced Multi-Currency Implementation Guide
Advanced Multi-Currency Implementation Guide
Dan Macarie avatar
Written by Dan Macarie
Updated over a week ago

For updated information, please see: Adding-support-for-multi-currency in our documentation

Introduction

In this article, you will learn how to implement Nosto in a multi-currency environment if you are using a third party exchange rate service and frequently update product price information. When the implementation is completed, you will be able to display product price in different currencies to relevant target groups.

Note: Nosto doesn’t provide any exchange rate services.

Before you start

Prior to the multi-currency specific implementation, make sure that the Nosto tagging is correctly in place. The Nosto Tagging Guide can be found here. Once the tagging is correctly applied, data exchange occurs and Nosto tracks behavioral events and updates product catalogue information in real-time.

However, tagging must be slightly extended to achieve an advanced multi-currency implementation.

Product page tagging

The Nosto product page tagging must be extended to include information related to the different currencies offered by the online store.

Typically, a primary currency has been set for the online store. For example, a US based retailer could offer Euro and British pound to European customers. US Dollar is the primary currency while Euro and British pound are in this example secondary currencies.

An additional span tag must be placed within the product page tagging with a classname variation_id. The tag is a child element of the nosto_product div tag.

<span class="variation_id" style="display: none;">USD</span>

With the example above, the extended product page would be the following:

<div class="nosto_product" style="display: none;">
 <span class="url">http://example.com/product/CANOE123</span>
 <span class="product_id">CANOE123</span>
 <span class="name">ACME Foldable Canoe</span>
 <span class="image_url">http://example.com/i/CANOE123.jpg</span>
 <span class="price">100.00</span>
 <span class="price_currency_code">USD</span>
 <span class="availability">InStock</span>
 <span class="category">/Outdoor/Boats/Canoes</span>
 <span class="category">/Sales/Boats</span>
 <span class="description">This foldable canoe is easy to travel with.</span>
 <span class="list_price">110.00</span>
 <span class="brand">ACME</span>
 <span class="tag1">Men</span>
 <span class="tag2">Foldable</span>
 <span class="tag3">Brown</span>
 <span class="tag3">Black</span>
 <span class="tag3">Orange</span>

<!-- Variation ID for the primary currency -->

<span class="variation_id">USD</span>

</div>

Note: The tagging above needs to remain static, regardless of the currency active on-site.

All pages tagging

Once you have extended the product page tagging, a separate and additional div tag must be added to all the other pages (including the product page itself). The tag shouldn’t be encapsulated in the nosto_product div tag. The information sent in the tag refers dynamically to the currency active on the user’s browser.

<div class="nosto_variation" style="display: none;">USD</div>

API

You have to set-up API calls between your system and Nosto to inform our services about the exchange rates currently in use on your website. The exchange rates must be included within a JSON message and an authenticated HTTP request must be executed. An API Token is required to communicate with Nosto’ servers. Please contact support@nosto.com to get an API Token. Please inform our Support Team about your Nosto Account ID and request an API_RATES Token.

Once you have the token in hands, you can proceed to the API calls. Use an empty string as the username, and the API token provided by Nosto as the password. The authenticated HTTP POST request must be made to:

https://api.nosto.com/exchangerates

Including a JSON message body following the structure:

{
  "rates": {
    "GBP": {
      "rate": 0.77,
      "price_currency_code": "GBP"
    },
    "EUR": {
      "rate": 0.91,
      "price_currency_code": "EUR"
    }
  },
  "valid_until": "2015-02-27T12:00:00Z"
}

Note: The request must be made in HTTPS exclusively. You can view your API token value by signing up to your Nosto back-end at https://my.nosto.com and go to Settings > Other > Authentication Tokens.

In the example above, 0.77 is the exchange rate to get the price value in British pound from US Dollar and 0.91 is the exchange rate to get the price in Euro from US Dollar.

The valid_until entry defines the expiring date. When the expiring date is reached, the exchange rates won’t by applied anymore and prices will be hidden for all the secondary currencies. This is a security process to prevent displaying outdated prices.
When Nosto recommendations are loaded, exchange rates are dynamically applied to the price variable in use in the recommendation templates. The variable is $!product.price.

Here is an example of the request above as a cURL command line invocation:

curl -v -X POST -H 'Content-Type: application/json'-d '{"rates": {"GBP": {"rate": 0.77, "price_currency_code": "GBP"}, "EUR": {"rate": 0.91, "price_currency_code": "EUR"}}, "valid_until": "2015-02-27T12:00:00Z"}' -u ':tokenSecretHere' https://api.nosto.com/exchangerates

Admin Panel

When the tagging has been extended, you need to adjust the settings in your admin panel under Settings >> Currency Settings. Set the variation ID of the primary currency via the input field and toggle on the exchange rates switch if necessary in our case. You can also use it without exchange rates.

Note: Make sure the variation ID of the primary currency matches the values sent via the Nosto product page tagging through the variation_id tag and sent via all pages through the nosto_variation tag.

Set up & Review

Set up the Price formats according to your primary currency and secondary currencies:

You can also review if product information are correctly updated. This can be reviewed under Catalog Explorer >> Products >> select a Product >> in tab "Attributes" check the field "Pricing" .

When you have reviewed your setup, Nosto updates product prices for all the currencies in real-time and displays the appropriate currency to the right group of users.
You’re all set and ready to go live with our features.

Did this answer your question?