Skip to content

Instantly share code, notes, and snippets.

View md604's full-sized avatar

Maxim Dyuzhinov md604

View GitHub Profile
@md604
md604 / shop_events_listener.js
Created January 4, 2021 23:15
Lines 240-247
r(window, "load", function () {
for (var e = 0; e < document.forms.length; e++) {
var t = document.forms[e].getAttribute("action");
t && 0 <= t.indexOf("/cart/add") && (r(document.forms[e], "submit", a),
r(document.forms[e], "change", i),
d(document.forms[e]));
var n = document.forms[e].elements.previous_step;
n && "payment_method" === n.value && r(document.forms[e], "submit", o);
}
});
@md604
md604 / shop_events_listener.js
Created January 4, 2021 23:08
Lines 282-309
(e.fetch = function () {
var i = arguments;
return t.apply(this, Array.prototype.slice.call(arguments)).then(function (e) {
if (!e.ok) return e;
var t = document.createElement("a");
t.href = e.url;
var n = t.pathname ? t.pathname : e.url;
try {
switch (n) {
case "/cart/add.js":
@md604
md604 / trekkie.min.js
Created January 3, 2021 16:24
Additional order information
var v = {
id: t.orderName || t.checkoutId,
affiliation: t.affiliation,
revenue: t.total || t.revenue || 0,
tax: t.tax,
shipping: t.shipping,
coupon: t.coupon
};
@md604
md604 / trekkie.min.js
Created January 3, 2021 15:52
Lines 614-663
(t.prototype.viewedProductEnhanced = function (e) {
var t = e.properties;
this.loadEnhancedEcommerce(e);
var n = this.enhancedEcommerceTrackProduct(t);
window.ga("ec:setAction", "detail");
var r = this.pushEnhancedEcommerce(e);
this.addMonorailBatchEvent({ eventName: a.ANALYTICS_VIEWED_PRODUCT, eventProperties: JSON.stringify({ item: n, event: r }) });
}),
(t.prototype.addedProductEnhanced = function (e) {
var t = e.properties;
@md604
md604 / trekkie.min.js
Created January 3, 2021 15:36
Lines 716-719
(t.prototype.enhancedEcommerceTrackProduct = function (e) {
var t = {
id: e.sku || e.variantId,
name: e.name,
category: e.category,
quantity: this.getProductQuantity(e),
price: e.price,
brand: e.brand,
variant: e.variant,
currency: this.getCurrency(e.currency)
@md604
md604 / trekkie.min.js
Created January 2, 2021 22:28
Lines 688-693
(t.prototype.enhancedEcommerce = function () {
(this.viewedProduct = this.viewedProductEnhanced),
(this.addedProduct = this.addedProductEnhanced),
(this.startedOrder = this.startedOrderEnhanced),
(this.completedOrder = this.completedOrderEnhanced);
}),
@md604
md604 / trekkie.min.js
Last active January 2, 2021 19:18
Lines 664–674
(t.prototype.initialize = function (e) {
(this.pageCalled = !1), this.loadGAScript();
var n = this.options;
"localhost" === c.hostname() && (n.domain = "none"),
n.enhancedEcommerce && this.enhancedEcommerce(),
window.ga("create", n.trackingId, { cookieDomain: n.domain || t.defaultOptions.domain, siteSpeedSampleRate: n.siteSpeedSampleRate, sampleRate: n.sampleRate, allowLinker: !0 }),
n.doubleClick && window.ga("require", "displayfeatures"),
n.enhancedLinkAttribution && window.ga("require", "linkid"),
n.anonymizeIp && window.ga("set", "anonymizeIp", !0),
e();
...
if (Shopify.designMode) {
// editor mode helper function
const registerNewApps = function(event) {
const eventSectionId = event.detail.sectionId;
event
.target
.querySelectorAll(`div[data-app-id="${eventSectionId}"]`)
.forEach(appElement => {
<template>
<div class="vue-quote-app">
<div v-if="settings.title.length > 0" class="section-header text-center">
<h2>{{ settings.title }}</h2>
</div>
<div class="quotes-wrapper">
<div class="quotes-slider" :data-count="`${blocks.length}`">
<div v-for="(block, index) in blocks" :key="`block-id-${index}`">
<blockquote class="quotes-slider__text text-center">
<span class="quote-icon">
import './vue-section-quotes.scss';
import Vue from 'vue';
import Quotes from './quotes.vue';
export class QuotesApp {
constructor(id, data) {
this._sectionId = id;
this._appType = 'vue-quotes';
this._appInstance = null;
this._appData = data;