Tagging Order Content
Dan Macarie avatar
Written by Dan Macarie
Updated over a week ago

For updated information, please see: Order-Tagging in our documentations

The tagging enables Nosto to display recommendations based on purchase behaviour. The order content tagging is placed on a page where a successful order is communicated to the customer, in practice when a customer returns back to the store from the payment service after paying the purchases.

<!-- Tag your PurchaseOrders, replace static example values to equivalent database/ecom engine variables -->
<div class="nosto_page_type" style="display:none">order</div>        
  <div class="nosto_purchase_order" style="display:none">
    <span class="order_number">1445</span>
      <div class="buyer">
        <span class="email">Jack.Bauer@example.com</span>
        <span class="first_name">Jack</span>
        <span class="last_name">Bauer</span>
        <span class="marketing_permission">true</span>
    <div class="purchased_items">
<!-- Check your ecom engine how to loop over purchased items to produce the line_item divs -->
      <div class="line_item">
        <span class="product_id">CANOE123</span>
        <span class="quantity">1</span>
        <span class="name">ACME Foldable Canoe</span>
        <span class="unit_price">1269.00</span>
        <span class="price_currency_code">EUR</span>
      <div class="line_item">
        <span class="product_id">TOOTHBR</span>
        <span class="quantity">3</span>
        <span class="name">Large yellow toothbrush</span>
        <span class="unit_price">19.00</span>
        <span class="price_currency_code">EUR</span>

General Guidelines

The productID needs to be consistent with the productID on the product and cart tagging. Overall sum is not required, simply map the quantity of line items and unit selling price including VAT.

In case a site has for any reason multiple order confirmation pages, the tagging needs to be present on each similarly to Google’s conversion tracking script. If a site hosts order confirmation page under different domain than site itself, such as secure.company.com, while the site is found under www.company.com, add the additional hostname under account settings in the Nosto admin into field: Other hosts used by the site (one per line) so that Nosto accepts traffic from the additional hostname.

How to test? Make a test order having debugger enabled and see the output on order confirmation page.

There’s only one step left after you’ve finalised order tagging, see it next!

Cross-Domain Order Tracking

In a normal Nosto implementation, the order-confirmation/thank-you page is on the same domain as the rest of the site.

The Nosto cookie is a first-party cookie and always tied to the domain it was issued on.

There are cases when the order-confirmation/thank-you page is on a different domain than the rest of the site. In these cases revenue will not be correctly tracked as the cookie issue on the order-confirmation/thank-you page is different from the rest of the site.

To support this scenario we have an additional snippet of tagging that can be implemented on both domains to inform Nosto that the visitor is in fact the same visitor across both domains. Nosto will then use this information to attribute the order to visitor who came from the other domain.

Mark’s Gift Shop is accessible at marks.com. When customers make a purchase and check out, they end up on a order-confirmation/thank-you page on orders.marks.com.

A visitor shopping on marks.com and after a successful purchase, ending up on orders.marks.com will be treated as a separate vistors as the visitor has two separate cookies – one from marks.com and the other from orders.marks.com.

Adding the following snippet in your markup along with the rest of the Nosto markup will allow the visitor’s shopping journey to be correctly tracked across both domains.

<div class="nosto_external_visit_ref" style="display:none">{{ page.session_id }}</div>

The identifier passed in the external_visit_ref must be unique for that visitor and must be the same across both the domains.

Common external visit references are often the platform’s internal session identifier or the cart/checkout identifier.

Tagging the buyer

You can omit the buyer tagging either partially, or completely if you do not want Nosto to crawl this information. The user details are stored for possible marketing purposes and mainly observed email address is used in this context. Marketing permission is false by default but if this user has explicitly agreed to receive marketing then you can set it to true manually.

Tagging the currencies

Currencies should always be represented in the ISO-4471 three-letter format. For example, use the code USD instead of $ to represent the United States Dollar.

Adding support for advanced use cases

Many ecommerce stores utilize SKU:s or "child" products that are sorted under the same "parent" product. To extend the above example with SKU support refer to this article: https://docs.nosto.com/techdocs/implementing-nosto/implement-on-your-website/advanced-implementation/extending-tagging-with-skus

In cases where a product might have multiple prices in differing currencies you can also add support for multi-currency. Refer to this article: https://docs.nosto.com/techdocs/apis/frontend/implementation-guide-session-api/advanced-usage/spa-adding-support-for-multi-currency

Troubleshooting order tagging:

Once included on all pages, you can review if the site is transmitting data using the Nosto Debug Toolbar. If you can see order contents being picked up under "Tagging" → "Order" then the order details are correctly set up in the source code.

You can further verify your session in the Nosto admin by using the live feed under: https://my.nosto.com/admin/$accountID/liveFeed to see if Nosto correctly picks up product view → product carted → product bought events. You can export all the order history from the store under Settings → Other → Order report under https://my.nosto.com/admin/$account/account/orders/report

Did this answer your question?