@walkeros/web-destination-gtag 3.3.1 → 3.4.0
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/dist/dev.d.mts +20 -2
- package/dist/dev.d.ts +20 -2
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +20 -2
- package/dist/examples/index.d.ts +20 -2
- package/dist/examples/index.js +203 -87
- package/dist/examples/index.mjs +203 -87
- package/dist/walkerOS.json +235 -102
- package/package.json +2 -2
package/dist/examples/index.mjs
CHANGED
|
@@ -58,10 +58,13 @@ var simulation = [
|
|
|
58
58
|
var step_exports = {};
|
|
59
59
|
__export(step_exports, {
|
|
60
60
|
addToCart: () => addToCart,
|
|
61
|
+
adsInit: () => adsInit,
|
|
61
62
|
consentModeV2: () => consentModeV2,
|
|
63
|
+
ga4Init: () => ga4Init,
|
|
62
64
|
ga4WithIncludeAll: () => ga4WithIncludeAll,
|
|
63
65
|
googleAdsConversion: () => googleAdsConversion,
|
|
64
66
|
gtmDataLayerPush: () => gtmDataLayerPush,
|
|
67
|
+
gtmInit: () => gtmInit,
|
|
65
68
|
multipleToolsSimultaneous: () => multipleToolsSimultaneous,
|
|
66
69
|
pageView: () => pageView,
|
|
67
70
|
purchase: () => purchase
|
|
@@ -74,9 +77,9 @@ var c = {};
|
|
|
74
77
|
for (var o in n) e(t, o, { get: n[o], enumerable: true });
|
|
75
78
|
})(c, { Level: () => u });
|
|
76
79
|
var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(u || {});
|
|
77
|
-
var
|
|
80
|
+
var W = { merge: true, shallow: true, extend: true };
|
|
78
81
|
function L(e2, t = {}, n = {}) {
|
|
79
|
-
n = { ...
|
|
82
|
+
n = { ...W, ...n };
|
|
80
83
|
const o = Object.entries(t).reduce((t2, [o2, r]) => {
|
|
81
84
|
const i = e2[o2];
|
|
82
85
|
return n.merge && Array.isArray(i) && Array.isArray(r) ? t2[o2] = r.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || o2 in e2) && (t2[o2] = r), t2;
|
|
@@ -91,7 +94,7 @@ function Q(e2) {
|
|
|
91
94
|
}
|
|
92
95
|
function fe(e2 = {}) {
|
|
93
96
|
var _a;
|
|
94
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = L({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: o, version: { source: "3.
|
|
97
|
+
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = L({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: o, version: { source: "3.4.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
|
|
95
98
|
if (e2.name) {
|
|
96
99
|
const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
97
100
|
t2 && n2 && (r.entity = t2, r.action = n2);
|
|
@@ -104,6 +107,46 @@ function le(e2 = "entity action", t = {}) {
|
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
// src/examples/step.ts
|
|
110
|
+
var INIT_DATE_MS = 17e11;
|
|
111
|
+
var INIT_DATE = new Date(INIT_DATE_MS);
|
|
112
|
+
var ga4Init = {
|
|
113
|
+
in: {
|
|
114
|
+
settings: {
|
|
115
|
+
ga4: { measurementId: "G-XXXXXX-1" }
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
out: [
|
|
119
|
+
["gtag", "js", INIT_DATE],
|
|
120
|
+
["gtag", "config", "G-XXXXXX-1", {}]
|
|
121
|
+
]
|
|
122
|
+
};
|
|
123
|
+
var adsInit = {
|
|
124
|
+
in: {
|
|
125
|
+
settings: {
|
|
126
|
+
ads: { conversionId: "AW-123456789", currency: "EUR" }
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
out: [
|
|
130
|
+
["gtag", "js", INIT_DATE],
|
|
131
|
+
["gtag", "config", "AW-123456789"]
|
|
132
|
+
]
|
|
133
|
+
};
|
|
134
|
+
var gtmInit = {
|
|
135
|
+
in: {
|
|
136
|
+
settings: {
|
|
137
|
+
gtm: { containerId: "GTM-XXXXXXX" }
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
out: [
|
|
141
|
+
[
|
|
142
|
+
"dataLayer.push",
|
|
143
|
+
{
|
|
144
|
+
"gtm.start": INIT_DATE_MS,
|
|
145
|
+
event: "gtm.js"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
]
|
|
149
|
+
};
|
|
107
150
|
var purchase = {
|
|
108
151
|
in: le("order complete", { timestamp: 1700000100 }),
|
|
109
152
|
mapping: {
|
|
@@ -133,20 +176,30 @@ var purchase = {
|
|
|
133
176
|
}
|
|
134
177
|
},
|
|
135
178
|
out: [
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
179
|
+
[
|
|
180
|
+
"gtag",
|
|
181
|
+
"event",
|
|
182
|
+
"purchase",
|
|
183
|
+
{
|
|
184
|
+
transaction_id: "0rd3r1d",
|
|
185
|
+
value: 555,
|
|
186
|
+
tax: 73.76,
|
|
187
|
+
shipping: 5.22,
|
|
188
|
+
currency: "EUR",
|
|
189
|
+
items: [
|
|
190
|
+
{ item_id: "ers", item_name: "Everyday Ruck Snack", quantity: 1 },
|
|
191
|
+
{ item_id: "cc", item_name: "Cool Cap", quantity: 1 }
|
|
192
|
+
],
|
|
193
|
+
// include: ['data', 'context'] flattens both sections as prefixed params.
|
|
194
|
+
data_id: "0rd3r1d",
|
|
195
|
+
data_currency: "EUR",
|
|
196
|
+
data_shipping: 5.22,
|
|
197
|
+
data_taxes: 73.76,
|
|
198
|
+
data_total: 555,
|
|
199
|
+
context_shopping: "complete",
|
|
200
|
+
send_to: "G-XXXXXX-1"
|
|
201
|
+
}
|
|
202
|
+
]
|
|
150
203
|
]
|
|
151
204
|
};
|
|
152
205
|
var addToCart = {
|
|
@@ -174,20 +227,29 @@ var addToCart = {
|
|
|
174
227
|
}
|
|
175
228
|
},
|
|
176
229
|
out: [
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
230
|
+
[
|
|
231
|
+
"gtag",
|
|
232
|
+
"event",
|
|
233
|
+
"add_to_cart",
|
|
234
|
+
{
|
|
235
|
+
currency: "EUR",
|
|
236
|
+
value: 420,
|
|
237
|
+
items: [{ item_id: "ers", item_variant: "black", quantity: 1 }],
|
|
238
|
+
// include: ['data'] flattens data as prefixed params.
|
|
239
|
+
data_id: "ers",
|
|
240
|
+
data_name: "Everyday Ruck Snack",
|
|
241
|
+
data_color: "black",
|
|
242
|
+
data_size: "l",
|
|
243
|
+
data_price: 420,
|
|
244
|
+
send_to: "G-XXXXXX-1"
|
|
245
|
+
}
|
|
246
|
+
]
|
|
185
247
|
]
|
|
186
248
|
};
|
|
187
249
|
var pageView = {
|
|
188
250
|
in: le("page view", { timestamp: 1700000102 }),
|
|
189
251
|
mapping: void 0,
|
|
190
|
-
out: ["event", "page_view", { send_to: "G-XXXXXX-1" }]
|
|
252
|
+
out: [["gtag", "event", "page_view", { send_to: "G-XXXXXX-1" }]]
|
|
191
253
|
};
|
|
192
254
|
var googleAdsConversion = {
|
|
193
255
|
in: le("order complete", { timestamp: 1700000103 }),
|
|
@@ -203,13 +265,16 @@ var googleAdsConversion = {
|
|
|
203
265
|
}
|
|
204
266
|
},
|
|
205
267
|
out: [
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
268
|
+
[
|
|
269
|
+
"gtag",
|
|
270
|
+
"event",
|
|
271
|
+
"conversion",
|
|
272
|
+
{
|
|
273
|
+
send_to: "AW-123456789/PURCHASE_CONV",
|
|
274
|
+
currency: "EUR",
|
|
275
|
+
value: 555
|
|
276
|
+
}
|
|
277
|
+
]
|
|
213
278
|
]
|
|
214
279
|
};
|
|
215
280
|
var gtmDataLayerPush = {
|
|
@@ -226,24 +291,44 @@ var gtmDataLayerPush = {
|
|
|
226
291
|
}
|
|
227
292
|
}
|
|
228
293
|
},
|
|
229
|
-
out:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
294
|
+
out: [
|
|
295
|
+
[
|
|
296
|
+
"dataLayer.push",
|
|
297
|
+
{
|
|
298
|
+
event: "page_view",
|
|
299
|
+
page_title: "walkerOS documentation",
|
|
300
|
+
page_location: "www.example.com"
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
]
|
|
234
304
|
};
|
|
235
305
|
var consentModeV2 = {
|
|
236
306
|
command: "consent",
|
|
237
307
|
in: { marketing: true, functional: true },
|
|
238
308
|
out: [
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
309
|
+
// First consent call sets default to denied for all mapped parameters.
|
|
310
|
+
[
|
|
311
|
+
"gtag",
|
|
312
|
+
"consent",
|
|
313
|
+
"default",
|
|
314
|
+
{
|
|
315
|
+
ad_storage: "denied",
|
|
316
|
+
ad_user_data: "denied",
|
|
317
|
+
ad_personalization: "denied",
|
|
318
|
+
analytics_storage: "denied"
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
[
|
|
322
|
+
"gtag",
|
|
323
|
+
"consent",
|
|
324
|
+
"update",
|
|
325
|
+
{
|
|
326
|
+
ad_storage: "granted",
|
|
327
|
+
ad_user_data: "granted",
|
|
328
|
+
ad_personalization: "granted",
|
|
329
|
+
analytics_storage: "granted"
|
|
330
|
+
}
|
|
331
|
+
]
|
|
247
332
|
]
|
|
248
333
|
};
|
|
249
334
|
var ga4WithIncludeAll = {
|
|
@@ -252,37 +337,47 @@ var ga4WithIncludeAll = {
|
|
|
252
337
|
include: ["all"]
|
|
253
338
|
},
|
|
254
339
|
out: [
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
340
|
+
[
|
|
341
|
+
"gtag",
|
|
342
|
+
"event",
|
|
343
|
+
"page_view",
|
|
344
|
+
{
|
|
345
|
+
// data_* params from event.data
|
|
346
|
+
data_domain: "www.example.com",
|
|
347
|
+
data_title: "walkerOS documentation",
|
|
348
|
+
data_referrer: "https://www.walkeros.io/",
|
|
349
|
+
data_search: "?foo=bar",
|
|
350
|
+
data_hash: "#hash",
|
|
351
|
+
data_id: "/docs/",
|
|
352
|
+
// context_* params from event.context
|
|
353
|
+
context_dev: "test",
|
|
354
|
+
// globals_* params from event.globals
|
|
355
|
+
globals_pagegroup: "docs",
|
|
356
|
+
// user_* params from event.user
|
|
357
|
+
user_id: "us3r",
|
|
358
|
+
user_device: "c00k13",
|
|
359
|
+
user_session: "s3ss10n",
|
|
360
|
+
// source_* params from event.source
|
|
361
|
+
source_type: "web",
|
|
362
|
+
source_id: "https://localhost:80",
|
|
363
|
+
source_previous_id: "http://remotehost:9001",
|
|
364
|
+
// event_* params from event properties
|
|
365
|
+
event_entity: "page",
|
|
366
|
+
event_action: "view",
|
|
367
|
+
event_trigger: "load",
|
|
368
|
+
event_group: "gr0up",
|
|
369
|
+
event_count: 1,
|
|
370
|
+
event_id: "1700000106-gr0up-1",
|
|
371
|
+
event_name: "page view",
|
|
372
|
+
event_timestamp: 1700000106,
|
|
373
|
+
event_timing: 3.14,
|
|
374
|
+
// version_* params from event.version
|
|
375
|
+
version_source: "3.3.1",
|
|
376
|
+
version_tagging: 1,
|
|
377
|
+
// send_to is always set for GA4
|
|
378
|
+
send_to: "G-XXXXXX-1"
|
|
379
|
+
}
|
|
380
|
+
]
|
|
286
381
|
]
|
|
287
382
|
};
|
|
288
383
|
var multipleToolsSimultaneous = {
|
|
@@ -302,31 +397,52 @@ var multipleToolsSimultaneous = {
|
|
|
302
397
|
}
|
|
303
398
|
}
|
|
304
399
|
},
|
|
305
|
-
out:
|
|
306
|
-
|
|
400
|
+
out: [
|
|
401
|
+
[
|
|
402
|
+
"gtag",
|
|
307
403
|
"event",
|
|
308
404
|
"purchase",
|
|
309
405
|
{
|
|
310
406
|
value: 555,
|
|
311
407
|
currency: "EUR",
|
|
408
|
+
// include: ['data'] flattens data as prefixed params.
|
|
409
|
+
data_id: "0rd3r1d",
|
|
410
|
+
data_currency: "EUR",
|
|
411
|
+
data_shipping: 5.22,
|
|
412
|
+
data_taxes: 73.76,
|
|
413
|
+
data_total: 555,
|
|
312
414
|
send_to: "G-XXXXXX-1"
|
|
313
415
|
}
|
|
314
416
|
],
|
|
315
|
-
|
|
417
|
+
[
|
|
418
|
+
"gtag",
|
|
316
419
|
"event",
|
|
317
420
|
"conversion",
|
|
318
421
|
{
|
|
319
422
|
send_to: "AW-123456789/PURCHASE_CONV",
|
|
320
423
|
currency: "EUR",
|
|
321
|
-
value: 555
|
|
424
|
+
value: 555,
|
|
425
|
+
data_id: "0rd3r1d",
|
|
426
|
+
data_currency: "EUR",
|
|
427
|
+
data_shipping: 5.22,
|
|
428
|
+
data_taxes: 73.76,
|
|
429
|
+
data_total: 555
|
|
322
430
|
}
|
|
323
431
|
],
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
432
|
+
[
|
|
433
|
+
"dataLayer.push",
|
|
434
|
+
{
|
|
435
|
+
event: "purchase",
|
|
436
|
+
value: 555,
|
|
437
|
+
currency: "EUR",
|
|
438
|
+
data_id: "0rd3r1d",
|
|
439
|
+
data_currency: "EUR",
|
|
440
|
+
data_shipping: 5.22,
|
|
441
|
+
data_taxes: 73.76,
|
|
442
|
+
data_total: 555
|
|
443
|
+
}
|
|
444
|
+
]
|
|
445
|
+
]
|
|
330
446
|
};
|
|
331
447
|
export {
|
|
332
448
|
env_exports as env,
|