@nuskin/ns-shop 7.10.0-mdigi-7127.1 → 7.10.0-mdigi-7127.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cart/cart.js +17 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-shop",
3
- "version": "7.10.0-mdigi-7127.1",
3
+ "version": "7.10.0-mdigi-7127.3",
4
4
  "description": "The description that will amaze and astound your audience when they read it",
5
5
  "main": "src/shop.js",
6
6
  "scripts": {
package/src/cart/cart.js CHANGED
@@ -77,15 +77,27 @@ export default function Cart(cartData) {
77
77
  let scope = this;
78
78
 
79
79
  document.addEventListener('DOMContentLoaded', () => {
80
+ const isCartPage = window.location.pathname.includes('cart');
81
+ const isCheckoutPage = window.location.pathname.includes('checkout');
82
+
80
83
  if (window.dataLayer) {
81
- window.dataLayer.push({
82
- event: 'pageView',
83
- pageType: 'cart',
84
- currency: currencyCode
85
- });
84
+ if (isCartPage) {
85
+ window.dataLayer.push({
86
+ event: 'pageView',
87
+ pageType: 'cart',
88
+ currency: currencyCode
89
+ });
90
+ } else if (isCheckoutPage) {
91
+ window.dataLayer.push({
92
+ event: 'pageView',
93
+ pageType: 'checkout',
94
+ currency: currencyCode
95
+ });
96
+ }
86
97
  }
87
98
  });
88
99
 
100
+
89
101
  // ---------------------------------------------
90
102
  //
91
103
  // Define all public methods.