Nosto supports many variables that contain attributes to output dynamic content on the page as part of Nosto campaigns. For example, the context variable contains an attribute called categories that can be used to output the items currently in cart.

To output an variable's attribute, follow the structure below:

 $context.categories <<!-- Output: "Men, Men's shirts, Men's Summer Shirts" -->

In this article, you will find all supported variables by Nosto along with the various attributes tied to it. 


Cart information

$context.cartItems -  All currently carted items  

e.g. when available pick a single item by #set($item = context.cartItems.get(0))

$!item.quantity - The quantity of products for the cart item. 

$!item.total - The total cost for the cart item (i.e. quantity * cost). 

$!item.product - The product (see below for the available properties). 

$!item.selectedSku - If present, it means that the SKU was used for this cart item.

Category information

$context.categories - All categories labeled on the page

Product information 

You can review the product data Nosto has when you go to Tools > Products and search for the product.

$context.viewedProduct outputs the currently viewed product. It contains many variables such as: 

$!product.name - Product's name. To limit length to max. 30 characters, you can use 

$product.name.truncate(30) 

$!product.description - Product's description text 

$!product.url - Product page's url in the webshop 

$!product.categories - List of product categories.
Check first if $product.categories exists, then iterate over the list. 

$!product.price - Product's price.
Formatted according to merchant's settings 

$!product.listPrice - List price of the product. 

$!product.discounted - True in case if product's price is less than its list price by at least 1%. For example: 

#if($product.discounted
$product.discount.percent%
#end 

$!product.discount.amount - Amount of discount for a product formatted according to merchant's settings

$!product.discount.percent - Percent of discount of the product. 

$!product.discount.percent.round(decimals) - Percent of discount of the product, rounded to the given amount of decimals. 

$!product.imageUrl Product image url (original size)

$!product.thumb(size) - Product's thumbnail URL. Sizes range from 1 to 8 :

  1. 170 x 170 pixels
  2. 100 x 100 pixels
  3. 90 x 70 pixels
  4. 50 x 50 pixels
  5. 30 x 30 pixels
  6. 100 x 140 pixels
  7. Original aspect ratio with horizontal images having a width of 200 pixels and vertical images having a height of 200 pixels.
  8. Original aspect ratio with horizontal images having a width of 400 pixels and vertical images having a height of 400 pixels. 

$!product.productId - Product's id, aka. itemcode. ISBN, EAN preferable. 

$!product.brand - Product's brand. Variables can also be tested: 

#if($product.brand=="Acme") 
A good brand product!
#end. 

$!product.tags1, $!product.tags2, $!product.tags3 - Product tags, each set of tags can have multiple values. To refer to first value in tags1: 

$!product.tags1.get(0) - To do a conditional block based on tag: 

#if($product.tags2) 
do X
#else
do Y
#end 

$!product.inventoryLevel - Number of products left in inventory. 

$!product.reviewCount - Number of reviews collected. 

$!product.ratingValue - Rating. Value between 0.0 and 5.0. 

$!product.alternateImageUrls - Alternative Image URLs for products. 

$!product.ageInDays - Number of days since the product has been added to Nosto. You can use this if $product.datePublished isn't available. $!product.mostBought True if this product, of the result set 

$!product.tags3Contains - Check if value is contained in tags3 

$!product.lastPathOfProductUrl - Last path element of the product url 

$!product.thumbUrl - Thumbnail url $!product.thumbnailMode Declares mode how thumbnail url is created $!product.merchant Merchant name $!product.mock Will be true if the product is a mock. 

$!product.variationId - Variation id used in the template 

$!product.variations - Map of variation id to Product data 

$!product.variationIds - List of variation ids 

$!product.availability - The tagged availability of product, e.g. '"InStock" / "OutOfStock"

$!product.thumbVariantId - Variant id used in thumbnail generation 

$!product.skus Variant (SKU) data 

#foreach(sku in product.skus) 
[Print some product variant (SKU) related information here]
#end

Loop through the product variants (SKUs).

$!sku.id Variant's id. 

$!sku.productId Product id of this variant, equal to the id of the parent product. 

$!sku.name Variant's name. 

$!sku.listPrice Variant's list price. 

$!sku.price See the description of the corresponding product's field 

$!sku.discount See the description of the corresponding product's field 

$!sku.url See the description of the corresponding product's field 

$!sku.imageUrl See the description of the corresponding product's field 

$!sku.customFields Set of variant's custom fields. 

$!sku.getCustomField Use getCustomField(customFieldName)  to get the value of variant's custom field with name customFieldName. 

$!sku.available Will be true if the variant is available. 

$!sku.thumb See the description of the corresponding product's field 

$!product.maxPrice Max variant price. Equivalent to getMaxPrice(false)

$!product.minPrice Min variant price. Equivalent to getMinPrice(false)

$!product.getMaxPrice Use getMaxPrice(onlyAvailable)  to find max variant price. If onlyAvailableis true, only the in-stock variants will be taken into account. If there are no variants available, this function will return the price of "parent" product. 

$!product.getMinPrice Use getMinPrice(onlyAvailable)  to find min variant price. If onlyAvailable is true, only the in-stock variants will be taken into account. If there are no variants available, this function will return the price of "parent" product. 

$!product.datePublished Publish date in UTC with dd.MM.yyyy format. TimeZone and format can be changed, for example $!product.datePublished.format("dd.MM.yyyy HH:mm:ss").timezone("Australia/Sydney")  

$!product.mostViewed True if this product, of the result set $products , has had the most views during the past week. 

$!product.currencySymbol Currency symbol 

$!product.currencyCode Currency code 

$!product.checkInventoryLevel Returns true if the inventory item is below the given threshold $!product.primaryThumb  Product's primary thumbnail URL. Sizes range from 1 to 8 

$!product.ugcThumb Product's UGC thumbnail URL. Sizes range from 1 to 8

$!product.imageHash Product's image hash 

$!product.primaryImageHash Product's primary image hash 

$!product.ugcImageHash Product's UGC image hash 

$!product.primaryImageUrl Product's primary image url 

$!product.ugcImageUrl Product's UGC image url 

$!product.skuCustomFields Return a entry set of sku custom field name to values 

$!product.customFields Return a entry set of product custom field name to values 

$!product.getCustomField Return the corresponding product custom field value 

$!product.getSkuOptions Use getSkuOptions(fields ...) to get product available skus grouping by custom fields such as color, size. 

$!product.getAllSkuOptions Same as getSkuOptions()  except getAllSkuOptions()  includes unavailable skus.

Did this answer your question?