Skip to content

Instantly share code, notes, and snippets.

{# snippet 'snippets/nosto.rain' #}
{% set account = 'ACCOUNT-ID-HERE' %}
<script type="text/javascript" src="//:my.nosto.com/include/{{ account }}" async></script>
{% if page.cart %}
<div class="nosto_external_visit_ref" style="display:none">{{ page.cart.quote_id }}</div>
{% endif %}
{% if order %}
<div class="nosto_external_visit_ref" style="display:none">{{ order.information.quote_id }}</div>
#if($couponCode)
<br><br>
Here's your personal coupon code that you can redeem on your next purchase
<br><br>
Coupon: <strong>$couponCode</strong>
#if($couponExpiry)
<br>
Valid Until: <strong>$couponExpiry</strong>
#end
#end
@larilehtonen
larilehtonen / gist:7d2ff95044ac29654462
Last active August 29, 2015 14:04
Adding coupon codes manually into Nosto default template
...
<p style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; font-size: 16px; line-height:1.5;">$!intro.paragraphText
#if($couponCode)
<br><br>
Here's your personal coupon code that you can redeem on your next purchase
<br><br>
Code: <strong>$couponCode</strong>
#if($couponExpiry)
<br>
@larilehtonen
larilehtonen / gist:615c7053c38939a4da27
Created May 8, 2014 14:22
Search term tagging for cf2tpz2s and ey3bw6nr
On search results page, apply tagging below:
<div class="nosto_search_term" style="display:none">OUTPUT_USED_SEARCH_TERM_HERE</div>
@larilehtonen
larilehtonen / Listing: Post-render callback example.
Created April 25, 2014 06:05
API callbacks: Current callback functions
nostojs(function(api){
api.listen("postrender", function(NostoPostRenderEvent){
console.log(NostoPostRenderEvent.filledElements);
console.log(NostoPostRenderEvent.unFilledElements);
});
});
nostojs(function(api){
api.listen(<position>, <your callback function>);
});
// Push customer information for current visit, if not present in tagging
nostojs(function(api) {
api.customer({ email: "foo@bar.com", first_name: "Jane", last_name: "Doe" });
});
@larilehtonen
larilehtonen / Listing: Product page view initiated from nosto-element.
Created April 25, 2014 06:03
Use cases: Refreshing page recommendations
//ajax product page view - call after product rendered on screen with nosto tagging html
nostojs(function(api) {
//OR IF product page view was initiated from nosto-element, add the nosto element's id
api.loadRecommendations(“nosto-categorypage-1”);
});
//ajax product page view - call after product rendered on screen with nosto tagging html
nostojs(function(api) {
//product page view was initiated from shop’s own product listing
api.loadRecommendations();
});
@larilehtonen
larilehtonen / Listing: Reporting add to cart to Nosto from click handler.
Created April 25, 2014 06:02
Use cases: Updating shopping cart information
// use case: recommendation with add to cart button
// call from button's clickhandler
nostojs(function(api){
api.reportAddToCart("productId1", "nosto-categorypage-1");
//if you also want to update the recommendations you can call
api.loadRecommendations();
});