@akinon/pz-b2b 1.21.0-rc.1 → 1.21.0-rc.10

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @akinon/pz-b2b
2
2
 
3
+ ## 1.21.0-rc.10
4
+
5
+ ## 1.21.0-rc.9
6
+
7
+ ## 1.21.0-rc.8
8
+
9
+ ## 1.21.0-rc.7
10
+
11
+ ## 1.21.0-rc.6
12
+
13
+ ## 1.21.0-rc.5
14
+
15
+ ## 1.21.0-rc.4
16
+
17
+ ## 1.21.0-rc.3
18
+
19
+ ## 1.21.0-rc.2
20
+
3
21
  ## 1.21.0-rc.1
4
22
 
5
23
  ## 1.21.0-rc.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/pz-b2b",
3
- "version": "1.21.0-rc.1",
3
+ "version": "1.21.0-rc.10",
4
4
  "license": "MIT",
5
5
  "main": "src/index.ts",
6
6
  "peerDependencies": {
package/src/utils/gtm.ts CHANGED
@@ -1,21 +1,16 @@
1
1
  'use client';
2
2
 
3
- import { GTMEvent, Product } from '@akinon/next/types';
3
+ import { GA4EventParams, GTMEvent, Product } from '@akinon/next/types';
4
4
 
5
5
  export const pushCartView = (
6
6
  products: Pick<Product, 'name' | 'pk' | 'price'>[]
7
7
  ) => {
8
- pushEvent({
9
- Action: 'Checkout',
10
- Label: 'Sepet',
11
- ecommerce: {
12
- products: products?.map((product) => ({
13
- name: product.name,
14
- id: product.pk,
15
- price: product.price
16
- }))
17
- },
18
- event: 'eeCheckout'
8
+ pushEventGA4('view_cart', {
9
+ items: products?.map((product) => ({
10
+ item_name: product.name,
11
+ item_id: product.pk,
12
+ price: product.price
13
+ }))
19
14
  });
20
15
  };
21
16
 
@@ -24,3 +19,13 @@ export const pushEvent = (event: GTMEvent) => {
24
19
 
25
20
  window.dataLayer.push({ Category, Value, ...rest });
26
21
  };
22
+
23
+ export const pushEventGA4 = (
24
+ eventAction: string,
25
+ eventParams: GA4EventParams
26
+ ) => {
27
+ window.dataLayer.push({
28
+ event: eventAction,
29
+ ...eventParams
30
+ });
31
+ };