shopify-google-analytics-helper
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};function r(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,c=void 0===o?"":o,a=r.currencyCode,u=void 0===a?"USD":a,s=r.debug,d=void 0!==s&&s,m=function(e,r){return d&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},l=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice\n\tcompareAtPrice\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},p=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,c=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price,compareAtPrice:t.compareAtPrice,variantId:c,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+c}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:l(t)):Promise.resolve("object"==typeof t?t:l(t)).then(r))}catch(t){return Promise.reject(t)}},v=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price}},f=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,c=i.list,a=i.position;return Promise.resolve(p(r)).then(function(r){var n=a||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},v(r),{index:n});return c&&(i.item_list_name=c),m(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return m(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(p(e)).then(function(e){return e?m(n,{ecommerce:{items:[t({},v(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return m("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(t){try{var e=h("view_cart");return Promise.resolve(e(t))}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}}export{r as default}; | ||
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};function r(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,a=void 0===o?"":o,c=r.currencyCode,u=void 0===c?"USD":c,s=r.debug,d=void 0!==s&&s,m=function(e,r){return d&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},l=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":a},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice { amount }\n\tcompareAtPrice { amount }\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},p=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,a=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price.amount,compareAtPrice:t.compareAtPrice.amount,variantId:a,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+a}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:l(t)):Promise.resolve("object"==typeof t?t:l(t)).then(r))}catch(t){return Promise.reject(t)}},v=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price.amount}},f=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,a=i.list,c=i.position;return Promise.resolve(p(r)).then(function(r){var n=c||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},v(r),{index:n});return a&&(i.item_list_name=a),m(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return m(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(p(e)).then(function(e){return e?m(n,{ecommerce:{items:[t({},v(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return m("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(t){try{var e=h("view_cart");return Promise.resolve(e(t))}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}}export{r as default}; | ||
//# sourceMappingURL=bundle.es.js.map |
@@ -1,2 +0,2 @@ | ||
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};module.exports=function(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,c=void 0===o?"":o,a=r.currencyCode,u=void 0===a?"USD":a,s=r.debug,d=void 0!==s&&s,m=function(e,r){return d&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},l=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice\n\tcompareAtPrice\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},p=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,c=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price,compareAtPrice:t.compareAtPrice,variantId:c,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+c}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:l(t)):Promise.resolve("object"==typeof t?t:l(t)).then(r))}catch(t){return Promise.reject(t)}},v=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price}},f=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,c=i.list,a=i.position;return Promise.resolve(p(r)).then(function(r){var n=a||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},v(r),{index:n});return c&&(i.item_list_name=c),m(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return m(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(p(e)).then(function(e){return e?m(n,{ecommerce:{items:[t({},v(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return m("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(t){try{var e=h("view_cart");return Promise.resolve(e(t))}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}}; | ||
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};module.exports=function(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,a=void 0===o?"":o,c=r.currencyCode,u=void 0===c?"USD":c,s=r.debug,d=void 0!==s&&s,m=function(e,r){return d&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},l=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":a},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice { amount }\n\tcompareAtPrice { amount }\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},p=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,a=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price.amount,compareAtPrice:t.compareAtPrice.amount,variantId:a,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+a}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:l(t)):Promise.resolve("object"==typeof t?t:l(t)).then(r))}catch(t){return Promise.reject(t)}},v=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price.amount}},f=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,a=i.list,c=i.position;return Promise.resolve(p(r)).then(function(r){var n=c||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},v(r),{index:n});return a&&(i.item_list_name=a),m(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return m(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(p(e)).then(function(e){return e?m(n,{ecommerce:{items:[t({},v(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return m("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(t){try{var e=h("view_cart");return Promise.resolve(e(t))}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}}; | ||
//# sourceMappingURL=bundle.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).shopifyGoogleAnalyticsHelper=e()}(this,function(){function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};return function(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,c=void 0===o?"":o,a=r.currencyCode,u=void 0===a?"USD":a,d=r.debug,s=void 0!==d&&d,l=function(e,r){return s&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},f=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice\n\tcompareAtPrice\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},p=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,c=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price,compareAtPrice:t.compareAtPrice,variantId:c,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+c}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:f(t)):Promise.resolve("object"==typeof t?t:f(t)).then(r))}catch(t){return Promise.reject(t)}},m=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price}},v=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,c=i.list,a=i.position;return Promise.resolve(p(r)).then(function(r){var n=a||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},m(r),{index:n});return c&&(i.item_list_name=c),l(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return l(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(p(e)).then(function(e){return e?l(n,{ecommerce:{items:[t({},m(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return v("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return v("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return l("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(t){try{var e=h("view_cart");return Promise.resolve(e(t))}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).shopifyGoogleAnalyticsHelper=e()}(this,function(){function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};return function(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,c=void 0===o?"":o,a=r.currencyCode,u=void 0===a?"USD":a,d=r.debug,s=void 0!==d&&d,m=function(e,r){return s&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},l=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice { amount }\n\tcompareAtPrice { amount }\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},f=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,c=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price.amount,compareAtPrice:t.compareAtPrice.amount,variantId:c,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+c}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:l(t)):Promise.resolve("object"==typeof t?t:l(t)).then(r))}catch(t){return Promise.reject(t)}},p=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price.amount}},v=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,c=i.list,a=i.position;return Promise.resolve(f(r)).then(function(r){var n=a||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},p(r),{index:n});return c&&(i.item_list_name=c),m(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return m(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(f(e)).then(function(e){return e?m(n,{ecommerce:{items:[t({},p(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return v("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return v("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return m("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(t){try{var e=h("view_cart");return Promise.resolve(e(t))}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}}}); | ||
//# sourceMappingURL=bundle.umd.js.map |
{ | ||
"name": "shopify-google-analytics-helper", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
"license": "MIT", | ||
"engines": { | ||
"node": ">=16.0.0" | ||
}, | ||
"repository": { | ||
@@ -49,5 +52,5 @@ "type": "git", | ||
"microbundle": "^0.15.0", | ||
"np": "^7.6.2", | ||
"np": "^8.0.4", | ||
"prettier": "^2.7.1" | ||
} | ||
} |
@@ -88,4 +88,4 @@ import { fetchVariantQuery } from "./queries" | ||
sku: variant.sku, | ||
price: variant.price, | ||
compareAtPrice: variant.compareAtPrice, | ||
price: variant.price.amount, | ||
compareAtPrice: variant.compareAtPrice.amount, | ||
variantId, | ||
@@ -118,3 +118,3 @@ variantTitle: variant.title, | ||
item_variant: flatVariant.variantTitle, | ||
price: flatVariant.price, | ||
price: flatVariant.price.amount, | ||
}) | ||
@@ -121,0 +121,0 @@ |
@@ -5,4 +5,4 @@ export const productVariantFragment = `fragment variant on ProductVariant { | ||
title | ||
price | ||
compareAtPrice | ||
price { amount } | ||
compareAtPrice { amount } | ||
image { originalSrc } | ||
@@ -9,0 +9,0 @@ product { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
80032
0.93%372
0.27%