@reactionary/google-analytics 0.9.1 → 0.9.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.
|
@@ -7,6 +7,9 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
|
|
|
7
7
|
super(cache, context);
|
|
8
8
|
this.config = configuration;
|
|
9
9
|
}
|
|
10
|
+
getResourceName() {
|
|
11
|
+
return "google-analytics";
|
|
12
|
+
}
|
|
10
13
|
async processProductSummaryView(event) {
|
|
11
14
|
const gaEvent = {
|
|
12
15
|
client_id: event.personalizationProfile?.identifier.key || "anonymous",
|
|
@@ -26,6 +29,7 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
|
|
|
26
29
|
]
|
|
27
30
|
};
|
|
28
31
|
await this.sendEvent(gaEvent);
|
|
32
|
+
return this.accepted();
|
|
29
33
|
}
|
|
30
34
|
async processProductSummaryClick(event) {
|
|
31
35
|
const gaEvent = {
|
|
@@ -47,6 +51,7 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
|
|
|
47
51
|
]
|
|
48
52
|
};
|
|
49
53
|
await this.sendEvent(gaEvent);
|
|
54
|
+
return this.accepted();
|
|
50
55
|
}
|
|
51
56
|
async processProductDetailsView(event) {
|
|
52
57
|
const gaEvent = {
|
|
@@ -67,6 +72,7 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
|
|
|
67
72
|
]
|
|
68
73
|
};
|
|
69
74
|
await this.sendEvent(gaEvent);
|
|
75
|
+
return this.accepted();
|
|
70
76
|
}
|
|
71
77
|
async processProductAddToCart(event) {
|
|
72
78
|
const gaEvent = {
|
|
@@ -87,6 +93,7 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
|
|
|
87
93
|
]
|
|
88
94
|
};
|
|
89
95
|
await this.sendEvent(gaEvent);
|
|
96
|
+
return this.accepted();
|
|
90
97
|
}
|
|
91
98
|
async processPurchase(event) {
|
|
92
99
|
const gaEvent = {
|
|
@@ -111,6 +118,7 @@ class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
|
|
|
111
118
|
]
|
|
112
119
|
};
|
|
113
120
|
await this.sendEvent(gaEvent);
|
|
121
|
+
return this.accepted();
|
|
114
122
|
}
|
|
115
123
|
async sendEvent(event) {
|
|
116
124
|
const url = `${this.config.url}?measurement_id=${this.config.measurementId}&api_secret=${this.config.apiSecret}`;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/google-analytics",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@reactionary/core": "0.9.
|
|
8
|
+
"@reactionary/core": "0.9.3",
|
|
9
9
|
"zod": "4.1.9",
|
|
10
10
|
"vitest": "^4.0.9",
|
|
11
11
|
"@nx/vite": "22.4.5"
|
|
@@ -3,10 +3,11 @@ import type { GoogleAnalyticsConfiguration } from '../schema/configuration.schem
|
|
|
3
3
|
export declare class GoogleAnalyticsAnalyticsCapability extends AnalyticsCapability {
|
|
4
4
|
protected config: GoogleAnalyticsConfiguration;
|
|
5
5
|
constructor(cache: Cache, context: RequestContext, configuration: GoogleAnalyticsConfiguration);
|
|
6
|
-
protected
|
|
7
|
-
protected
|
|
8
|
-
protected
|
|
9
|
-
protected
|
|
10
|
-
protected
|
|
6
|
+
protected getResourceName(): string;
|
|
7
|
+
protected processProductSummaryView(event: AnalyticsMutationProductSummaryViewEvent): Promise<import("@reactionary/core").AnalyticsResult>;
|
|
8
|
+
protected processProductSummaryClick(event: AnalyticsMutationProductSummaryClickEvent): Promise<import("@reactionary/core").AnalyticsResult>;
|
|
9
|
+
protected processProductDetailsView(event: AnalyticsMutationProductDetailsViewEvent): Promise<import("@reactionary/core").AnalyticsResult>;
|
|
10
|
+
protected processProductAddToCart(event: AnalyticsMutationProductAddToCartEvent): Promise<import("@reactionary/core").AnalyticsResult>;
|
|
11
|
+
protected processPurchase(event: AnalyticsMutationPurchaseEvent): Promise<import("@reactionary/core").AnalyticsResult>;
|
|
11
12
|
protected sendEvent(event: unknown): Promise<void>;
|
|
12
13
|
}
|