@reactionary/google-analytics 0.9.0 → 0.9.1

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.
@@ -9,8 +9,8 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
9
9
  }
10
10
  async processProductSummaryView(event) {
11
11
  const gaEvent = {
12
- client_id: this.context.session.identityContext.personalizationKey,
13
- user_id: this.context.session.identityContext.personalizationKey,
12
+ client_id: event.personalizationProfile?.identifier.key || "anonymous",
13
+ user_id: event.personalizationProfile?.identifier.key || "anonymous",
14
14
  events: [
15
15
  {
16
16
  name: "view_item_list",
@@ -29,8 +29,8 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
29
29
  }
30
30
  async processProductSummaryClick(event) {
31
31
  const gaEvent = {
32
- client_id: this.context.session.identityContext.personalizationKey,
33
- user_id: this.context.session.identityContext.personalizationKey,
32
+ client_id: event.personalizationProfile?.identifier.key || "anonymous",
33
+ user_id: event.personalizationProfile?.identifier.key || "anonymous",
34
34
  events: [
35
35
  {
36
36
  name: "select_item",
@@ -50,8 +50,8 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
50
50
  }
51
51
  async processProductDetailsView(event) {
52
52
  const gaEvent = {
53
- client_id: this.context.session.identityContext.personalizationKey,
54
- user_id: this.context.session.identityContext.personalizationKey,
53
+ client_id: event.personalizationProfile?.identifier.key || "anonymous",
54
+ user_id: event.personalizationProfile?.identifier.key || "anonymous",
55
55
  events: [
56
56
  {
57
57
  name: "view_item",
@@ -70,8 +70,8 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
70
70
  }
71
71
  async processProductAddToCart(event) {
72
72
  const gaEvent = {
73
- client_id: this.context.session.identityContext.personalizationKey,
74
- user_id: this.context.session.identityContext.personalizationKey,
73
+ client_id: event.personalizationProfile?.identifier.key || "anonymous",
74
+ user_id: event.personalizationProfile?.identifier.key || "anonymous",
75
75
  events: [
76
76
  {
77
77
  name: "add_to_cart",
@@ -90,8 +90,8 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
90
90
  }
91
91
  async processPurchase(event) {
92
92
  const gaEvent = {
93
- client_id: this.context.session.identityContext.personalizationKey,
94
- user_id: this.context.session.identityContext.personalizationKey,
93
+ client_id: event.personalizationProfile?.identifier.key || "anonymous",
94
+ user_id: event.personalizationProfile?.identifier.key || "anonymous",
95
95
  events: [
96
96
  {
97
97
  name: "purchase",
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@reactionary/google-analytics",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./src/index.d.ts",
7
7
  "dependencies": {
8
- "@reactionary/core": "0.9.0",
8
+ "@reactionary/core": "0.9.1",
9
9
  "zod": "4.1.9",
10
10
  "vitest": "^4.0.9",
11
11
  "@nx/vite": "22.4.5"