@walkeros/web-destination-gtag 2.0.0 → 2.1.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 +16 -54
- package/dist/dev.d.ts +16 -54
- 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 +10 -49
- package/dist/examples/index.d.ts +10 -49
- package/dist/examples/index.js +111 -219
- package/dist/examples/index.mjs +110 -217
- package/dist/index.browser.js +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/walkerOS.json +306 -233
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Mapping as Mapping$1 } from '@walkeros/core';
|
|
2
1
|
import { DestinationWeb } from '@walkeros/web-core';
|
|
2
|
+
import { Flow } from '@walkeros/core';
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
interface Window {
|
|
@@ -24,21 +24,6 @@ interface Env extends DestinationWeb.Env {
|
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
interface AdsMapping {
|
|
28
|
-
label?: string;
|
|
29
|
-
}
|
|
30
|
-
interface Mapping {
|
|
31
|
-
ga4?: GA4Mapping;
|
|
32
|
-
ads?: AdsMapping;
|
|
33
|
-
gtm?: GTMMapping;
|
|
34
|
-
}
|
|
35
|
-
interface GA4Mapping {
|
|
36
|
-
include?: Include;
|
|
37
|
-
}
|
|
38
|
-
interface GTMMapping {
|
|
39
|
-
}
|
|
40
|
-
type Rule = Mapping$1.Rule<Mapping>;
|
|
41
|
-
type Include = Array<'all' | 'context' | 'data' | 'event' | 'globals' | 'source' | 'user' | 'version'>;
|
|
42
27
|
|
|
43
28
|
declare const init: Env | undefined;
|
|
44
29
|
declare const push: Env;
|
|
@@ -51,39 +36,15 @@ declare namespace env {
|
|
|
51
36
|
export { env_init as init, env_push as push, env_simulation as simulation };
|
|
52
37
|
}
|
|
53
38
|
|
|
54
|
-
declare
|
|
55
|
-
declare
|
|
56
|
-
declare
|
|
57
|
-
declare function gtmEvent(): Record<string, unknown>;
|
|
58
|
-
|
|
59
|
-
declare const events_gtmEvent: typeof gtmEvent;
|
|
60
|
-
declare namespace events {
|
|
61
|
-
export { adsConversion$1 as adsConversion, ga4AddToCart$1 as ga4AddToCart, ga4Purchase$1 as ga4Purchase, events_gtmEvent as gtmEvent };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
declare const ga4Purchase: Rule;
|
|
65
|
-
declare const ga4AddToCart: Rule;
|
|
66
|
-
declare const adsConversion: Rule;
|
|
67
|
-
declare const gtmProductView: Rule;
|
|
68
|
-
declare const combinedPurchase: Rule;
|
|
69
|
-
declare const config: {
|
|
70
|
-
order: {
|
|
71
|
-
complete: Rule;
|
|
72
|
-
};
|
|
73
|
-
product: {
|
|
74
|
-
add: Rule;
|
|
75
|
-
view: Rule;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
39
|
+
declare const purchase: Flow.StepExample;
|
|
40
|
+
declare const addToCart: Flow.StepExample;
|
|
41
|
+
declare const pageView: Flow.StepExample;
|
|
78
42
|
|
|
79
|
-
declare const
|
|
80
|
-
declare const
|
|
81
|
-
declare const
|
|
82
|
-
declare
|
|
83
|
-
|
|
84
|
-
declare const mapping_gtmProductView: typeof gtmProductView;
|
|
85
|
-
declare namespace mapping {
|
|
86
|
-
export { mapping_adsConversion as adsConversion, mapping_combinedPurchase as combinedPurchase, mapping_config as config, mapping_ga4AddToCart as ga4AddToCart, mapping_ga4Purchase as ga4Purchase, mapping_gtmProductView as gtmProductView };
|
|
43
|
+
declare const step_addToCart: typeof addToCart;
|
|
44
|
+
declare const step_pageView: typeof pageView;
|
|
45
|
+
declare const step_purchase: typeof purchase;
|
|
46
|
+
declare namespace step {
|
|
47
|
+
export { step_addToCart as addToCart, step_pageView as pageView, step_purchase as purchase };
|
|
87
48
|
}
|
|
88
49
|
|
|
89
|
-
export { env,
|
|
50
|
+
export { env, step };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Mapping as Mapping$1 } from '@walkeros/core';
|
|
2
1
|
import { DestinationWeb } from '@walkeros/web-core';
|
|
2
|
+
import { Flow } from '@walkeros/core';
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
interface Window {
|
|
@@ -24,21 +24,6 @@ interface Env extends DestinationWeb.Env {
|
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
interface AdsMapping {
|
|
28
|
-
label?: string;
|
|
29
|
-
}
|
|
30
|
-
interface Mapping {
|
|
31
|
-
ga4?: GA4Mapping;
|
|
32
|
-
ads?: AdsMapping;
|
|
33
|
-
gtm?: GTMMapping;
|
|
34
|
-
}
|
|
35
|
-
interface GA4Mapping {
|
|
36
|
-
include?: Include;
|
|
37
|
-
}
|
|
38
|
-
interface GTMMapping {
|
|
39
|
-
}
|
|
40
|
-
type Rule = Mapping$1.Rule<Mapping>;
|
|
41
|
-
type Include = Array<'all' | 'context' | 'data' | 'event' | 'globals' | 'source' | 'user' | 'version'>;
|
|
42
27
|
|
|
43
28
|
declare const init: Env | undefined;
|
|
44
29
|
declare const push: Env;
|
|
@@ -51,39 +36,15 @@ declare namespace env {
|
|
|
51
36
|
export { env_init as init, env_push as push, env_simulation as simulation };
|
|
52
37
|
}
|
|
53
38
|
|
|
54
|
-
declare
|
|
55
|
-
declare
|
|
56
|
-
declare
|
|
57
|
-
declare function gtmEvent(): Record<string, unknown>;
|
|
58
|
-
|
|
59
|
-
declare const events_gtmEvent: typeof gtmEvent;
|
|
60
|
-
declare namespace events {
|
|
61
|
-
export { adsConversion$1 as adsConversion, ga4AddToCart$1 as ga4AddToCart, ga4Purchase$1 as ga4Purchase, events_gtmEvent as gtmEvent };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
declare const ga4Purchase: Rule;
|
|
65
|
-
declare const ga4AddToCart: Rule;
|
|
66
|
-
declare const adsConversion: Rule;
|
|
67
|
-
declare const gtmProductView: Rule;
|
|
68
|
-
declare const combinedPurchase: Rule;
|
|
69
|
-
declare const config: {
|
|
70
|
-
order: {
|
|
71
|
-
complete: Rule;
|
|
72
|
-
};
|
|
73
|
-
product: {
|
|
74
|
-
add: Rule;
|
|
75
|
-
view: Rule;
|
|
76
|
-
};
|
|
77
|
-
};
|
|
39
|
+
declare const purchase: Flow.StepExample;
|
|
40
|
+
declare const addToCart: Flow.StepExample;
|
|
41
|
+
declare const pageView: Flow.StepExample;
|
|
78
42
|
|
|
79
|
-
declare const
|
|
80
|
-
declare const
|
|
81
|
-
declare const
|
|
82
|
-
declare
|
|
83
|
-
|
|
84
|
-
declare const mapping_gtmProductView: typeof gtmProductView;
|
|
85
|
-
declare namespace mapping {
|
|
86
|
-
export { mapping_adsConversion as adsConversion, mapping_combinedPurchase as combinedPurchase, mapping_config as config, mapping_ga4AddToCart as ga4AddToCart, mapping_ga4Purchase as ga4Purchase, mapping_gtmProductView as gtmProductView };
|
|
43
|
+
declare const step_addToCart: typeof addToCart;
|
|
44
|
+
declare const step_pageView: typeof pageView;
|
|
45
|
+
declare const step_purchase: typeof purchase;
|
|
46
|
+
declare namespace step {
|
|
47
|
+
export { step_addToCart as addToCart, step_pageView as pageView, step_purchase as purchase };
|
|
87
48
|
}
|
|
88
49
|
|
|
89
|
-
export { env,
|
|
50
|
+
export { env, step };
|
package/dist/examples/index.js
CHANGED
|
@@ -21,8 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var examples_exports = {};
|
|
22
22
|
__export(examples_exports, {
|
|
23
23
|
env: () => env_exports,
|
|
24
|
-
|
|
25
|
-
mapping: () => mapping_exports
|
|
24
|
+
step: () => step_exports
|
|
26
25
|
});
|
|
27
26
|
module.exports = __toCommonJS(examples_exports);
|
|
28
27
|
|
|
@@ -76,253 +75,146 @@ var simulation = [
|
|
|
76
75
|
// Track gtag function calls
|
|
77
76
|
];
|
|
78
77
|
|
|
79
|
-
// src/examples/
|
|
80
|
-
var
|
|
81
|
-
__export(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
gtmEvent: () => gtmEvent
|
|
78
|
+
// src/examples/step.ts
|
|
79
|
+
var step_exports = {};
|
|
80
|
+
__export(step_exports, {
|
|
81
|
+
addToCart: () => addToCart,
|
|
82
|
+
pageView: () => pageView,
|
|
83
|
+
purchase: () => purchase
|
|
86
84
|
});
|
|
87
85
|
|
|
88
86
|
// ../../../core/dist/index.mjs
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
((
|
|
92
|
-
for (var o in n) e
|
|
93
|
-
})(
|
|
94
|
-
var u = ((
|
|
95
|
-
var
|
|
96
|
-
function
|
|
97
|
-
n = { ...
|
|
98
|
-
const o = Object.entries(
|
|
99
|
-
const i =
|
|
100
|
-
return n.merge && Array.isArray(i) && Array.isArray(r) ?
|
|
87
|
+
var t = Object.defineProperty;
|
|
88
|
+
var a = {};
|
|
89
|
+
((e, n) => {
|
|
90
|
+
for (var o in n) t(e, o, { get: n[o], enumerable: true });
|
|
91
|
+
})(a, { Level: () => u });
|
|
92
|
+
var u = ((t2) => (t2[t2.ERROR = 0] = "ERROR", t2[t2.WARN = 1] = "WARN", t2[t2.INFO = 2] = "INFO", t2[t2.DEBUG = 3] = "DEBUG", t2))(u || {});
|
|
93
|
+
var D = { merge: true, shallow: true, extend: true };
|
|
94
|
+
function H(t2, e = {}, n = {}) {
|
|
95
|
+
n = { ...D, ...n };
|
|
96
|
+
const o = Object.entries(e).reduce((e2, [o2, r]) => {
|
|
97
|
+
const i = t2[o2];
|
|
98
|
+
return n.merge && Array.isArray(i) && Array.isArray(r) ? e2[o2] = r.reduce((t3, e3) => t3.includes(e3) ? t3 : [...t3, e3], [...i]) : (n.extend || o2 in t2) && (e2[o2] = r), e2;
|
|
101
99
|
}, {});
|
|
102
|
-
return n.shallow ? { ...
|
|
100
|
+
return n.shallow ? { ...t2, ...o } : (Object.assign(t2, o), t2);
|
|
103
101
|
}
|
|
104
|
-
function
|
|
105
|
-
return Array.isArray(
|
|
102
|
+
function W(t2) {
|
|
103
|
+
return Array.isArray(t2);
|
|
106
104
|
}
|
|
107
|
-
function
|
|
108
|
-
return "object" == typeof
|
|
105
|
+
function Z(t2) {
|
|
106
|
+
return "object" == typeof t2 && null !== t2 && !W(t2) && "[object Object]" === Object.prototype.toString.call(t2);
|
|
109
107
|
}
|
|
110
|
-
function
|
|
108
|
+
function nt(t2 = {}) {
|
|
111
109
|
var _a;
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
114
|
-
const [
|
|
115
|
-
|
|
110
|
+
const e = t2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = t2.group || "gr0up", o = t2.count || 1, r = H({ 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: `${e}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: e, timing: 3.14, group: n, count: o, version: { source: "2.0.1", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, t2, { merge: false });
|
|
111
|
+
if (t2.name) {
|
|
112
|
+
const [e2, n2] = (_a = t2.name.split(" ")) != null ? _a : [];
|
|
113
|
+
e2 && n2 && (r.entity = e2, r.action = n2);
|
|
116
114
|
}
|
|
117
115
|
return r;
|
|
118
116
|
}
|
|
119
|
-
function
|
|
120
|
-
const n =
|
|
121
|
-
return
|
|
117
|
+
function ot(t2 = "entity action", e = {}) {
|
|
118
|
+
const n = e.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
119
|
+
return nt({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[t2], ...e, name: t2 });
|
|
122
120
|
}
|
|
123
121
|
|
|
124
|
-
// src/examples/
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
122
|
+
// src/examples/step.ts
|
|
123
|
+
var purchase = {
|
|
124
|
+
in: ot("order complete", { timestamp: 1700000100 }),
|
|
125
|
+
mapping: {
|
|
126
|
+
name: "purchase",
|
|
127
|
+
settings: {
|
|
128
|
+
ga4: {
|
|
129
|
+
include: ["data", "context"]
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
data: {
|
|
133
|
+
map: {
|
|
134
|
+
transaction_id: "data.id",
|
|
135
|
+
value: "data.total",
|
|
136
|
+
tax: "data.taxes",
|
|
137
|
+
shipping: "data.shipping",
|
|
138
|
+
currency: { key: "data.currency", value: "EUR" },
|
|
139
|
+
items: {
|
|
140
|
+
loop: [
|
|
141
|
+
"nested",
|
|
142
|
+
{
|
|
143
|
+
condition: (entity) => Z(entity) && entity.entity === "product",
|
|
144
|
+
map: {
|
|
145
|
+
item_id: "data.id",
|
|
146
|
+
item_name: "data.name",
|
|
147
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
142
153
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
function ga4AddToCart() {
|
|
146
|
-
const event = q("product add");
|
|
147
|
-
return [
|
|
154
|
+
},
|
|
155
|
+
out: [
|
|
148
156
|
"event",
|
|
149
|
-
"
|
|
157
|
+
"purchase",
|
|
150
158
|
{
|
|
159
|
+
transaction_id: "0rd3r1d",
|
|
160
|
+
value: 555,
|
|
161
|
+
tax: 73.76,
|
|
162
|
+
shipping: 5.22,
|
|
151
163
|
currency: "EUR",
|
|
152
|
-
value: event.data.price,
|
|
153
164
|
items: [
|
|
154
|
-
{
|
|
155
|
-
|
|
156
|
-
item_variant: event.data.color,
|
|
157
|
-
quantity: 1
|
|
158
|
-
}
|
|
165
|
+
{ item_id: "ers", item_name: "Everyday Ruck Snack", quantity: 1 },
|
|
166
|
+
{ item_id: "cc", item_name: "Cool Cap", quantity: 1 }
|
|
159
167
|
],
|
|
160
168
|
send_to: "G-XXXXXX-1"
|
|
161
169
|
}
|
|
162
|
-
]
|
|
163
|
-
}
|
|
164
|
-
function adsConversion() {
|
|
165
|
-
const event = q("order complete");
|
|
166
|
-
return [
|
|
167
|
-
"event",
|
|
168
|
-
"conversion",
|
|
169
|
-
{
|
|
170
|
-
send_to: "AW-XXXXXXXXX/CONVERSION_LABEL",
|
|
171
|
-
currency: "EUR",
|
|
172
|
-
value: event.data.total,
|
|
173
|
-
transaction_id: event.data.id
|
|
174
|
-
}
|
|
175
|
-
];
|
|
176
|
-
}
|
|
177
|
-
function gtmEvent() {
|
|
178
|
-
const event = q("product view");
|
|
179
|
-
return {
|
|
180
|
-
event: "product_view",
|
|
181
|
-
product_id: event.data.id,
|
|
182
|
-
product_name: event.data.name,
|
|
183
|
-
product_category: event.data.category,
|
|
184
|
-
value: event.data.price,
|
|
185
|
-
currency: "EUR"
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// src/examples/mapping.ts
|
|
190
|
-
var mapping_exports = {};
|
|
191
|
-
__export(mapping_exports, {
|
|
192
|
-
adsConversion: () => adsConversion2,
|
|
193
|
-
combinedPurchase: () => combinedPurchase,
|
|
194
|
-
config: () => config,
|
|
195
|
-
ga4AddToCart: () => ga4AddToCart2,
|
|
196
|
-
ga4Purchase: () => ga4Purchase2,
|
|
197
|
-
gtmProductView: () => gtmProductView
|
|
198
|
-
});
|
|
199
|
-
var ga4Purchase2 = {
|
|
200
|
-
name: "purchase",
|
|
201
|
-
settings: {
|
|
202
|
-
ga4: {
|
|
203
|
-
include: ["data", "context"]
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
data: {
|
|
207
|
-
map: {
|
|
208
|
-
transaction_id: "data.id",
|
|
209
|
-
value: "data.total",
|
|
210
|
-
tax: "data.taxes",
|
|
211
|
-
shipping: "data.shipping",
|
|
212
|
-
currency: { key: "data.currency", value: "EUR" },
|
|
213
|
-
items: {
|
|
214
|
-
loop: [
|
|
215
|
-
"nested",
|
|
216
|
-
{
|
|
217
|
-
condition: (entity) => D(entity) && entity.entity === "product",
|
|
218
|
-
map: {
|
|
219
|
-
item_id: "data.id",
|
|
220
|
-
item_name: "data.name",
|
|
221
|
-
quantity: { key: "data.quantity", value: 1 }
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
170
|
+
]
|
|
228
171
|
};
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
data: {
|
|
237
|
-
map: {
|
|
238
|
-
currency: { value: "EUR", key: "data.currency" },
|
|
239
|
-
value: "data.price",
|
|
240
|
-
items: {
|
|
241
|
-
loop: [
|
|
242
|
-
"this",
|
|
243
|
-
{
|
|
244
|
-
map: {
|
|
245
|
-
item_id: "data.id",
|
|
246
|
-
item_variant: "data.color",
|
|
247
|
-
quantity: { value: 1, key: "data.quantity" }
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
]
|
|
172
|
+
var addToCart = {
|
|
173
|
+
in: ot("product add", { timestamp: 1700000101 }),
|
|
174
|
+
mapping: {
|
|
175
|
+
name: "add_to_cart",
|
|
176
|
+
settings: {
|
|
177
|
+
ga4: {
|
|
178
|
+
include: ["data"]
|
|
251
179
|
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
var adsConversion2 = {
|
|
256
|
-
name: "CONVERSION_LABEL",
|
|
257
|
-
// This becomes the conversion label
|
|
258
|
-
settings: {
|
|
259
|
-
ads: {}
|
|
260
|
-
},
|
|
261
|
-
data: {
|
|
262
|
-
map: {
|
|
263
|
-
value: "data.total",
|
|
264
|
-
currency: { value: "EUR", key: "data.currency" },
|
|
265
|
-
transaction_id: "data.id"
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
var gtmProductView = {
|
|
270
|
-
name: "product_view",
|
|
271
|
-
settings: {
|
|
272
|
-
gtm: {}
|
|
273
|
-
},
|
|
274
|
-
data: {
|
|
275
|
-
map: {
|
|
276
|
-
product_id: "data.id",
|
|
277
|
-
product_name: "data.name",
|
|
278
|
-
product_category: "data.category",
|
|
279
|
-
value: "data.price",
|
|
280
|
-
currency: { value: "EUR", key: "data.currency" }
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
var combinedPurchase = {
|
|
285
|
-
name: "purchase",
|
|
286
|
-
// GA4 event name
|
|
287
|
-
settings: {
|
|
288
|
-
ga4: {
|
|
289
|
-
include: ["data"]
|
|
290
180
|
},
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
condition: (entity) => D(entity) && entity.entity === "product",
|
|
305
|
-
map: {
|
|
306
|
-
item_id: "data.id",
|
|
307
|
-
item_name: "data.name",
|
|
308
|
-
quantity: { value: 1, key: "data.quantity" }
|
|
181
|
+
data: {
|
|
182
|
+
map: {
|
|
183
|
+
currency: { value: "EUR", key: "data.currency" },
|
|
184
|
+
value: "data.price",
|
|
185
|
+
items: {
|
|
186
|
+
loop: [
|
|
187
|
+
"this",
|
|
188
|
+
{
|
|
189
|
+
map: {
|
|
190
|
+
item_id: "data.id",
|
|
191
|
+
item_variant: "data.color",
|
|
192
|
+
quantity: { value: 1, key: "data.quantity" }
|
|
193
|
+
}
|
|
309
194
|
}
|
|
310
|
-
|
|
311
|
-
|
|
195
|
+
]
|
|
196
|
+
}
|
|
312
197
|
}
|
|
313
198
|
}
|
|
314
|
-
}
|
|
199
|
+
},
|
|
200
|
+
out: [
|
|
201
|
+
"event",
|
|
202
|
+
"add_to_cart",
|
|
203
|
+
{
|
|
204
|
+
currency: "EUR",
|
|
205
|
+
value: 420,
|
|
206
|
+
items: [{ item_id: "ers", item_variant: "black", quantity: 1 }],
|
|
207
|
+
send_to: "G-XXXXXX-1"
|
|
208
|
+
}
|
|
209
|
+
]
|
|
315
210
|
};
|
|
316
|
-
var
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
view: gtmProductView
|
|
321
|
-
}
|
|
211
|
+
var pageView = {
|
|
212
|
+
in: ot("page view", { timestamp: 1700000102 }),
|
|
213
|
+
mapping: void 0,
|
|
214
|
+
out: ["event", "page_view", { send_to: "G-XXXXXX-1" }]
|
|
322
215
|
};
|
|
323
216
|
// Annotate the CommonJS export names for ESM import in node:
|
|
324
217
|
0 && (module.exports = {
|
|
325
218
|
env,
|
|
326
|
-
|
|
327
|
-
mapping
|
|
219
|
+
step
|
|
328
220
|
});
|