Skip to content

Instantly share code, notes, and snippets.

View jacopo-nosto's full-sized avatar

Jacopo Carassai jacopo-nosto

  • Berlin
View GitHub Profile
@jacopo-nosto
jacopo-nosto / mailchimp_attribution.js
Created November 23, 2017 10:17
Popup attribution from Mailchimp form
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',
@jacopo-nosto
jacopo-nosto / mini-cart-builder.js
Last active July 16, 2020 08:34
Mini cart builder (AIM'N AUSTRALIA) - Shopify and Ajax Cart (UNCOMPILED, UNBABELED)
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 / .html
Created March 5, 2020 11:03
Hiding/Displaying a Nosto element based on strings in the address (vanilla JS)
<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 / .js
Created June 29, 2018 08:33
Check if Slick has been loaded
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 / ac_generic.html
Last active September 15, 2015 15:49
Email AC template - NOSTO
## EMAIL LINK SETTINGS
#set( $mailsetting = {
"account" : $account,
"storeUrl" : $storeUrl,
"utm_source" : "nosto",
"utm_medium" : "email",
"utm_campaign" : "AbandonedCart",
"showInBrowserText" : $ASETUKSET.naytaSelaimessaTeksti,
"unsubscribeLinkText" : $unsubscribeLinkText