Skip to content

Instantly share code, notes, and snippets.

Avatar

Jacopo Carassai jacopo-nosto

  • Berlin
View GitHub Profile
@jacopo-nosto
jacopo-nosto / ac_generic.html
Last active Sep 15, 2015
Email AC template - NOSTO
View ac_generic.html
## EMAIL LINK SETTINGS
#set( $mailsetting = {
"account" : $account,
"storeUrl" : $storeUrl,
"utm_source" : "nosto",
"utm_medium" : "email",
"utm_campaign" : "AbandonedCart",
"showInBrowserText" : $ASETUKSET.naytaSelaimessaTeksti,
"unsubscribeLinkText" : $unsubscribeLinkText
@jacopo-nosto
jacopo-nosto / .js
Created Jun 29, 2018
Check if Slick has been loaded
View .js
function initMe(){
if(typeof _targetWindow.jQuery.fn.slick !== 'undefined'){
launchCarousel();
}else{
setTimeout(initMe, 300);
}
}
initMe();
_targetWindow.jQuery("#$divId .nosto-carousel").on('init', function(slick){
@jacopo-nosto
jacopo-nosto / .html
Created Mar 5, 2020
Hiding/Displaying a Nosto element based on strings in the address (vanilla JS)
View .html
<div class="nosto_element" id="frontpage-nosto-1"></div>
<script type="text/javascript">
var myElement = _targetWindow.document.querySelector("#frontpage-nosto-1 .nosto_element");
_targetWindow.document.onreadystatechange = function () {
if (_targetWindow.document.readyState === "complete") {
var checkURL = ['collections/cluster-chandelier-lights',
'collections/table-lamps',
'collections/vintage-retro-industrial-metal-bar-stools'];
@jacopo-nosto
jacopo-nosto / mini-cart-builder.js
Last active Jul 16, 2020
Mini cart builder (AIM'N AUSTRALIA) - Shopify and Ajax Cart (UNCOMPILED, UNBABELED)
View mini-cart-builder.js
var mycart, myitems, myprice, mytotal;
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
/* FIND THE UNCOMPILED, UNBABELED VERSION HERE ---> https://gist.github.com/jacopo-nosto/2e9f527b37a81b43b2b29b2beaff4247 */
function miniCartBuilder(elem) {
@jacopo-nosto
jacopo-nosto / mailchimp_attribution.js
Created Nov 23, 2017
Popup attribution from Mailchimp form
View mailchimp_attribution.js
doc.find("#takeMeThere").click(function(){
_targetWindow.nostojs(function(api){
var cookie = api.internal.overlay.discountPopup.instance.readCookie(<POPUP_CAMPAIGN_ID>);
if (cookie && !cookie.coupon) {
api.internal.overlay.discountPopup.instance.writeCookie(<POPUP_CAMPAIGN_ID>, "coupon", <COUPON_CODE>);
api.internal.couponGiven(<POPUP_CAMPAIGN_ID>, <COUPON_CODE>);
api.customer({
email: <EMAIL>,
newsletter: true,
source: 'discount-popup',