@escape-game-over/atlas 0.1.75 → 0.1.76
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.
- package/docs/client-scripts.md +3 -1
- package/package.json +1 -1
- package/src/astro/google-event.ts +16 -14
package/docs/client-scripts.md
CHANGED
|
@@ -581,7 +581,9 @@ googleEvent("form_submissions_contact"); // does not compile
|
|
|
581
581
|
A name nobody declared does not compile, so a typo cannot quietly become a
|
|
582
582
|
second event in a report — which is why this is not a `string` with the standard
|
|
583
583
|
names offered for autocomplete. Data declared with a required field is required
|
|
584
|
-
at every call.
|
|
584
|
+
at every call. A Google declaration may reuse a recommended name —
|
|
585
|
+
`generate_lead` with an agency's own parameters, say — and then takes what was
|
|
586
|
+
declared instead of GA4's. The interfaces are `GoogleCustomEvents`, `MetaCustomEvents`,
|
|
585
587
|
`TikTokCustomEvents`, `UmamiEvents`, `DripEvents` and `ClarityEvents`; Clarity
|
|
586
588
|
carries a name only, so its entries are all `undefined`. Snap and Axon take no
|
|
587
589
|
declarations because they accept no names but their own.
|
package/package.json
CHANGED
|
@@ -78,22 +78,24 @@ export interface GoogleEventData {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
|
-
* A
|
|
82
|
-
*
|
|
83
|
-
*
|
|
81
|
+
* A declared event takes what the project declared — checked first, so a
|
|
82
|
+
* project can declare a recommended name too, when its Tag Manager wants that
|
|
83
|
+
* name with its own parameters (an agency's `generate_lead`, say). Otherwise a
|
|
84
|
+
* recommended event takes GA4's parameters; `purchase` without its three
|
|
85
|
+
* reports a sale of nothing, possibly twice.
|
|
84
86
|
*/
|
|
85
87
|
type GoogleEventArgs<E extends GoogleEventName> =
|
|
86
|
-
E extends
|
|
87
|
-
? E
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
88
|
+
E extends DeclaredEvent<GoogleCustomEvents>
|
|
89
|
+
? EventDataArgs<GoogleCustomEvents[E]>
|
|
90
|
+
: E extends "purchase"
|
|
91
|
+
? [
|
|
92
|
+
data: GoogleEventData & {
|
|
93
|
+
value: number;
|
|
94
|
+
currency: CurrencyCode;
|
|
95
|
+
transaction_id: string;
|
|
96
|
+
},
|
|
97
|
+
]
|
|
98
|
+
: [data?: GoogleEventData];
|
|
97
99
|
|
|
98
100
|
/**
|
|
99
101
|
* Records an event with Google — a lead sent, a booking made — through
|