@walkeros/server-destination-datamanager 0.0.0-next-20251219153324
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/README.md +820 -0
- package/dist/dev.d.mts +233 -0
- package/dist/dev.d.ts +233 -0
- package/dist/dev.js +1 -0
- package/dist/dev.js.map +1 -0
- package/dist/dev.mjs +1 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/examples/index.d.mts +218 -0
- package/dist/examples/index.d.ts +218 -0
- package/dist/examples/index.js +320 -0
- package/dist/examples/index.mjs +297 -0
- package/dist/index.d.mts +388 -0
- package/dist/index.d.ts +388 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/dist/schemas.d.mts +6 -0
- package/dist/schemas.d.ts +6 -0
- package/dist/schemas.js +1 -0
- package/dist/schemas.js.map +1 -0
- package/dist/schemas.mjs +1 -0
- package/dist/schemas.mjs.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/examples/index.ts
|
|
21
|
+
var examples_exports = {};
|
|
22
|
+
__export(examples_exports, {
|
|
23
|
+
auth: () => auth_exports,
|
|
24
|
+
basic: () => basic_exports,
|
|
25
|
+
mapping: () => mapping_exports
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(examples_exports);
|
|
28
|
+
|
|
29
|
+
// src/examples/auth.ts
|
|
30
|
+
var auth_exports = {};
|
|
31
|
+
__export(auth_exports, {
|
|
32
|
+
awsLambda: () => awsLambda,
|
|
33
|
+
customScopes: () => customScopes,
|
|
34
|
+
dockerKubernetes: () => dockerKubernetes,
|
|
35
|
+
gcpCloudFunctions: () => gcpCloudFunctions,
|
|
36
|
+
localDevelopment: () => localDevelopment
|
|
37
|
+
});
|
|
38
|
+
var awsLambda = {
|
|
39
|
+
settings: {
|
|
40
|
+
credentials: {
|
|
41
|
+
client_email: process.env.GOOGLE_CLIENT_EMAIL || "",
|
|
42
|
+
private_key: (process.env.GOOGLE_PRIVATE_KEY || "").replace(/\\n/g, "\n")
|
|
43
|
+
},
|
|
44
|
+
destinations: [
|
|
45
|
+
{
|
|
46
|
+
operatingAccount: {
|
|
47
|
+
accountId: "123-456-7890",
|
|
48
|
+
accountType: "GOOGLE_ADS"
|
|
49
|
+
},
|
|
50
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var gcpCloudFunctions = {
|
|
56
|
+
settings: {
|
|
57
|
+
// No auth config needed - ADC works automatically on GCP!
|
|
58
|
+
destinations: [
|
|
59
|
+
{
|
|
60
|
+
operatingAccount: {
|
|
61
|
+
accountId: "123-456-7890",
|
|
62
|
+
accountType: "GOOGLE_ADS"
|
|
63
|
+
},
|
|
64
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var localDevelopment = {
|
|
70
|
+
settings: {
|
|
71
|
+
keyFilename: "./service-account.json",
|
|
72
|
+
destinations: [
|
|
73
|
+
{
|
|
74
|
+
operatingAccount: {
|
|
75
|
+
accountId: "123-456-7890",
|
|
76
|
+
accountType: "GOOGLE_ADS"
|
|
77
|
+
},
|
|
78
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var dockerKubernetes = {
|
|
84
|
+
settings: {
|
|
85
|
+
// No explicit config - ADC uses GOOGLE_APPLICATION_CREDENTIALS env var
|
|
86
|
+
destinations: [
|
|
87
|
+
{
|
|
88
|
+
operatingAccount: {
|
|
89
|
+
accountId: "123-456-7890",
|
|
90
|
+
accountType: "GOOGLE_ADS"
|
|
91
|
+
},
|
|
92
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var customScopes = {
|
|
98
|
+
settings: {
|
|
99
|
+
credentials: {
|
|
100
|
+
client_email: process.env.GOOGLE_CLIENT_EMAIL || "",
|
|
101
|
+
private_key: (process.env.GOOGLE_PRIVATE_KEY || "").replace(/\\n/g, "\n")
|
|
102
|
+
},
|
|
103
|
+
scopes: ["https://www.googleapis.com/auth/datamanager"],
|
|
104
|
+
destinations: [
|
|
105
|
+
{
|
|
106
|
+
operatingAccount: {
|
|
107
|
+
accountId: "123-456-7890",
|
|
108
|
+
accountType: "GOOGLE_ADS"
|
|
109
|
+
},
|
|
110
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// src/examples/basic.ts
|
|
117
|
+
var basic_exports = {};
|
|
118
|
+
__export(basic_exports, {
|
|
119
|
+
complete: () => complete,
|
|
120
|
+
debug: () => debug,
|
|
121
|
+
ga4: () => ga4,
|
|
122
|
+
minimal: () => minimal
|
|
123
|
+
});
|
|
124
|
+
var minimal = {
|
|
125
|
+
settings: {
|
|
126
|
+
credentials: {
|
|
127
|
+
client_email: "service-account@project.iam.gserviceaccount.com",
|
|
128
|
+
private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
|
|
129
|
+
},
|
|
130
|
+
destinations: [
|
|
131
|
+
{
|
|
132
|
+
operatingAccount: {
|
|
133
|
+
accountId: "123-456-7890",
|
|
134
|
+
accountType: "GOOGLE_ADS"
|
|
135
|
+
},
|
|
136
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
var complete = {
|
|
142
|
+
settings: {
|
|
143
|
+
credentials: {
|
|
144
|
+
client_email: "service-account@project.iam.gserviceaccount.com",
|
|
145
|
+
private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
|
|
146
|
+
},
|
|
147
|
+
destinations: [
|
|
148
|
+
{
|
|
149
|
+
operatingAccount: {
|
|
150
|
+
accountId: "123-456-7890",
|
|
151
|
+
accountType: "GOOGLE_ADS"
|
|
152
|
+
},
|
|
153
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
operatingAccount: {
|
|
157
|
+
accountId: "987654321",
|
|
158
|
+
accountType: "GOOGLE_ANALYTICS_PROPERTY"
|
|
159
|
+
},
|
|
160
|
+
productDestinationId: "G-XXXXXXXXXX"
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
batchSize: 100,
|
|
164
|
+
batchInterval: 5e3,
|
|
165
|
+
validateOnly: false,
|
|
166
|
+
consent: {
|
|
167
|
+
adUserData: "CONSENT_GRANTED",
|
|
168
|
+
adPersonalization: "CONSENT_GRANTED"
|
|
169
|
+
},
|
|
170
|
+
// Guided helpers (apply to all events)
|
|
171
|
+
userData: {
|
|
172
|
+
email: "user.id",
|
|
173
|
+
phone: "data.phone",
|
|
174
|
+
firstName: "data.firstName",
|
|
175
|
+
lastName: "data.lastName"
|
|
176
|
+
},
|
|
177
|
+
userId: "user.id",
|
|
178
|
+
clientId: "user.device",
|
|
179
|
+
sessionAttributes: "context.sessionAttributes"
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
var ga4 = {
|
|
183
|
+
settings: {
|
|
184
|
+
destinations: [
|
|
185
|
+
{
|
|
186
|
+
operatingAccount: {
|
|
187
|
+
accountId: "123456789",
|
|
188
|
+
accountType: "GOOGLE_ANALYTICS_PROPERTY"
|
|
189
|
+
},
|
|
190
|
+
productDestinationId: "G-XXXXXXXXXX"
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var debug = {
|
|
196
|
+
settings: {
|
|
197
|
+
keyFilename: "./service-account.json",
|
|
198
|
+
destinations: [
|
|
199
|
+
{
|
|
200
|
+
operatingAccount: {
|
|
201
|
+
accountId: "123-456-7890",
|
|
202
|
+
accountType: "GOOGLE_ADS"
|
|
203
|
+
},
|
|
204
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
// src/examples/mapping.ts
|
|
211
|
+
var mapping_exports = {};
|
|
212
|
+
__export(mapping_exports, {
|
|
213
|
+
Lead: () => Lead,
|
|
214
|
+
PageView: () => PageView,
|
|
215
|
+
Purchase: () => Purchase,
|
|
216
|
+
mapping: () => mapping,
|
|
217
|
+
userDataMapping: () => userDataMapping
|
|
218
|
+
});
|
|
219
|
+
var import_core = require("@walkeros/core");
|
|
220
|
+
var Purchase = {
|
|
221
|
+
name: "purchase",
|
|
222
|
+
data: {
|
|
223
|
+
map: {
|
|
224
|
+
// Required fields
|
|
225
|
+
transactionId: "data.id",
|
|
226
|
+
conversionValue: "data.total",
|
|
227
|
+
currency: { key: "data.currency", value: "USD" },
|
|
228
|
+
eventName: { value: "purchase" },
|
|
229
|
+
// User identification
|
|
230
|
+
userId: "user.id",
|
|
231
|
+
email: "user.id",
|
|
232
|
+
// Will be hashed automatically
|
|
233
|
+
// Attribution identifiers (captured by browser source from URL)
|
|
234
|
+
gclid: "context.gclid",
|
|
235
|
+
// Google Click ID
|
|
236
|
+
gbraid: "context.gbraid",
|
|
237
|
+
// iOS attribution
|
|
238
|
+
wbraid: "context.wbraid",
|
|
239
|
+
// Web-to-app
|
|
240
|
+
// Shopping cart data
|
|
241
|
+
cartData: {
|
|
242
|
+
map: {
|
|
243
|
+
items: {
|
|
244
|
+
loop: [
|
|
245
|
+
"nested",
|
|
246
|
+
{
|
|
247
|
+
condition: (entity) => (0, import_core.isObject)(entity) && entity.entity === "product",
|
|
248
|
+
map: {
|
|
249
|
+
merchantProductId: "data.id",
|
|
250
|
+
price: "data.price",
|
|
251
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
var Lead = {
|
|
262
|
+
name: "generate_lead",
|
|
263
|
+
data: {
|
|
264
|
+
map: {
|
|
265
|
+
eventName: { value: "generate_lead" },
|
|
266
|
+
conversionValue: { value: 10 },
|
|
267
|
+
currency: { value: "USD" }
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
var PageView = {
|
|
272
|
+
name: "page_view",
|
|
273
|
+
data: {
|
|
274
|
+
map: {
|
|
275
|
+
eventName: { value: "page_view" }
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
var mapping = {
|
|
280
|
+
order: {
|
|
281
|
+
complete: Purchase
|
|
282
|
+
},
|
|
283
|
+
lead: {
|
|
284
|
+
submit: Lead
|
|
285
|
+
},
|
|
286
|
+
page: {
|
|
287
|
+
view: PageView
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
var userDataMapping = {
|
|
291
|
+
settings: {
|
|
292
|
+
keyFilename: "./service-account.json",
|
|
293
|
+
destinations: [
|
|
294
|
+
{
|
|
295
|
+
operatingAccount: {
|
|
296
|
+
accountId: "123-456-7890",
|
|
297
|
+
accountType: "GOOGLE_ADS"
|
|
298
|
+
},
|
|
299
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
data: {
|
|
304
|
+
map: {
|
|
305
|
+
email: "user.id",
|
|
306
|
+
phone: "data.phone",
|
|
307
|
+
firstName: "data.firstName",
|
|
308
|
+
lastName: "data.lastName",
|
|
309
|
+
regionCode: "data.country",
|
|
310
|
+
postalCode: "data.zip"
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
mapping
|
|
314
|
+
};
|
|
315
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
316
|
+
0 && (module.exports = {
|
|
317
|
+
auth,
|
|
318
|
+
basic,
|
|
319
|
+
mapping
|
|
320
|
+
});
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/examples/auth.ts
|
|
8
|
+
var auth_exports = {};
|
|
9
|
+
__export(auth_exports, {
|
|
10
|
+
awsLambda: () => awsLambda,
|
|
11
|
+
customScopes: () => customScopes,
|
|
12
|
+
dockerKubernetes: () => dockerKubernetes,
|
|
13
|
+
gcpCloudFunctions: () => gcpCloudFunctions,
|
|
14
|
+
localDevelopment: () => localDevelopment
|
|
15
|
+
});
|
|
16
|
+
var awsLambda = {
|
|
17
|
+
settings: {
|
|
18
|
+
credentials: {
|
|
19
|
+
client_email: process.env.GOOGLE_CLIENT_EMAIL || "",
|
|
20
|
+
private_key: (process.env.GOOGLE_PRIVATE_KEY || "").replace(/\\n/g, "\n")
|
|
21
|
+
},
|
|
22
|
+
destinations: [
|
|
23
|
+
{
|
|
24
|
+
operatingAccount: {
|
|
25
|
+
accountId: "123-456-7890",
|
|
26
|
+
accountType: "GOOGLE_ADS"
|
|
27
|
+
},
|
|
28
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var gcpCloudFunctions = {
|
|
34
|
+
settings: {
|
|
35
|
+
// No auth config needed - ADC works automatically on GCP!
|
|
36
|
+
destinations: [
|
|
37
|
+
{
|
|
38
|
+
operatingAccount: {
|
|
39
|
+
accountId: "123-456-7890",
|
|
40
|
+
accountType: "GOOGLE_ADS"
|
|
41
|
+
},
|
|
42
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var localDevelopment = {
|
|
48
|
+
settings: {
|
|
49
|
+
keyFilename: "./service-account.json",
|
|
50
|
+
destinations: [
|
|
51
|
+
{
|
|
52
|
+
operatingAccount: {
|
|
53
|
+
accountId: "123-456-7890",
|
|
54
|
+
accountType: "GOOGLE_ADS"
|
|
55
|
+
},
|
|
56
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var dockerKubernetes = {
|
|
62
|
+
settings: {
|
|
63
|
+
// No explicit config - ADC uses GOOGLE_APPLICATION_CREDENTIALS env var
|
|
64
|
+
destinations: [
|
|
65
|
+
{
|
|
66
|
+
operatingAccount: {
|
|
67
|
+
accountId: "123-456-7890",
|
|
68
|
+
accountType: "GOOGLE_ADS"
|
|
69
|
+
},
|
|
70
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
var customScopes = {
|
|
76
|
+
settings: {
|
|
77
|
+
credentials: {
|
|
78
|
+
client_email: process.env.GOOGLE_CLIENT_EMAIL || "",
|
|
79
|
+
private_key: (process.env.GOOGLE_PRIVATE_KEY || "").replace(/\\n/g, "\n")
|
|
80
|
+
},
|
|
81
|
+
scopes: ["https://www.googleapis.com/auth/datamanager"],
|
|
82
|
+
destinations: [
|
|
83
|
+
{
|
|
84
|
+
operatingAccount: {
|
|
85
|
+
accountId: "123-456-7890",
|
|
86
|
+
accountType: "GOOGLE_ADS"
|
|
87
|
+
},
|
|
88
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// src/examples/basic.ts
|
|
95
|
+
var basic_exports = {};
|
|
96
|
+
__export(basic_exports, {
|
|
97
|
+
complete: () => complete,
|
|
98
|
+
debug: () => debug,
|
|
99
|
+
ga4: () => ga4,
|
|
100
|
+
minimal: () => minimal
|
|
101
|
+
});
|
|
102
|
+
var minimal = {
|
|
103
|
+
settings: {
|
|
104
|
+
credentials: {
|
|
105
|
+
client_email: "service-account@project.iam.gserviceaccount.com",
|
|
106
|
+
private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
|
|
107
|
+
},
|
|
108
|
+
destinations: [
|
|
109
|
+
{
|
|
110
|
+
operatingAccount: {
|
|
111
|
+
accountId: "123-456-7890",
|
|
112
|
+
accountType: "GOOGLE_ADS"
|
|
113
|
+
},
|
|
114
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var complete = {
|
|
120
|
+
settings: {
|
|
121
|
+
credentials: {
|
|
122
|
+
client_email: "service-account@project.iam.gserviceaccount.com",
|
|
123
|
+
private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
|
|
124
|
+
},
|
|
125
|
+
destinations: [
|
|
126
|
+
{
|
|
127
|
+
operatingAccount: {
|
|
128
|
+
accountId: "123-456-7890",
|
|
129
|
+
accountType: "GOOGLE_ADS"
|
|
130
|
+
},
|
|
131
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
operatingAccount: {
|
|
135
|
+
accountId: "987654321",
|
|
136
|
+
accountType: "GOOGLE_ANALYTICS_PROPERTY"
|
|
137
|
+
},
|
|
138
|
+
productDestinationId: "G-XXXXXXXXXX"
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
batchSize: 100,
|
|
142
|
+
batchInterval: 5e3,
|
|
143
|
+
validateOnly: false,
|
|
144
|
+
consent: {
|
|
145
|
+
adUserData: "CONSENT_GRANTED",
|
|
146
|
+
adPersonalization: "CONSENT_GRANTED"
|
|
147
|
+
},
|
|
148
|
+
// Guided helpers (apply to all events)
|
|
149
|
+
userData: {
|
|
150
|
+
email: "user.id",
|
|
151
|
+
phone: "data.phone",
|
|
152
|
+
firstName: "data.firstName",
|
|
153
|
+
lastName: "data.lastName"
|
|
154
|
+
},
|
|
155
|
+
userId: "user.id",
|
|
156
|
+
clientId: "user.device",
|
|
157
|
+
sessionAttributes: "context.sessionAttributes"
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
var ga4 = {
|
|
161
|
+
settings: {
|
|
162
|
+
destinations: [
|
|
163
|
+
{
|
|
164
|
+
operatingAccount: {
|
|
165
|
+
accountId: "123456789",
|
|
166
|
+
accountType: "GOOGLE_ANALYTICS_PROPERTY"
|
|
167
|
+
},
|
|
168
|
+
productDestinationId: "G-XXXXXXXXXX"
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
var debug = {
|
|
174
|
+
settings: {
|
|
175
|
+
keyFilename: "./service-account.json",
|
|
176
|
+
destinations: [
|
|
177
|
+
{
|
|
178
|
+
operatingAccount: {
|
|
179
|
+
accountId: "123-456-7890",
|
|
180
|
+
accountType: "GOOGLE_ADS"
|
|
181
|
+
},
|
|
182
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// src/examples/mapping.ts
|
|
189
|
+
var mapping_exports = {};
|
|
190
|
+
__export(mapping_exports, {
|
|
191
|
+
Lead: () => Lead,
|
|
192
|
+
PageView: () => PageView,
|
|
193
|
+
Purchase: () => Purchase,
|
|
194
|
+
mapping: () => mapping,
|
|
195
|
+
userDataMapping: () => userDataMapping
|
|
196
|
+
});
|
|
197
|
+
import { isObject } from "@walkeros/core";
|
|
198
|
+
var Purchase = {
|
|
199
|
+
name: "purchase",
|
|
200
|
+
data: {
|
|
201
|
+
map: {
|
|
202
|
+
// Required fields
|
|
203
|
+
transactionId: "data.id",
|
|
204
|
+
conversionValue: "data.total",
|
|
205
|
+
currency: { key: "data.currency", value: "USD" },
|
|
206
|
+
eventName: { value: "purchase" },
|
|
207
|
+
// User identification
|
|
208
|
+
userId: "user.id",
|
|
209
|
+
email: "user.id",
|
|
210
|
+
// Will be hashed automatically
|
|
211
|
+
// Attribution identifiers (captured by browser source from URL)
|
|
212
|
+
gclid: "context.gclid",
|
|
213
|
+
// Google Click ID
|
|
214
|
+
gbraid: "context.gbraid",
|
|
215
|
+
// iOS attribution
|
|
216
|
+
wbraid: "context.wbraid",
|
|
217
|
+
// Web-to-app
|
|
218
|
+
// Shopping cart data
|
|
219
|
+
cartData: {
|
|
220
|
+
map: {
|
|
221
|
+
items: {
|
|
222
|
+
loop: [
|
|
223
|
+
"nested",
|
|
224
|
+
{
|
|
225
|
+
condition: (entity) => isObject(entity) && entity.entity === "product",
|
|
226
|
+
map: {
|
|
227
|
+
merchantProductId: "data.id",
|
|
228
|
+
price: "data.price",
|
|
229
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
var Lead = {
|
|
240
|
+
name: "generate_lead",
|
|
241
|
+
data: {
|
|
242
|
+
map: {
|
|
243
|
+
eventName: { value: "generate_lead" },
|
|
244
|
+
conversionValue: { value: 10 },
|
|
245
|
+
currency: { value: "USD" }
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
var PageView = {
|
|
250
|
+
name: "page_view",
|
|
251
|
+
data: {
|
|
252
|
+
map: {
|
|
253
|
+
eventName: { value: "page_view" }
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var mapping = {
|
|
258
|
+
order: {
|
|
259
|
+
complete: Purchase
|
|
260
|
+
},
|
|
261
|
+
lead: {
|
|
262
|
+
submit: Lead
|
|
263
|
+
},
|
|
264
|
+
page: {
|
|
265
|
+
view: PageView
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
var userDataMapping = {
|
|
269
|
+
settings: {
|
|
270
|
+
keyFilename: "./service-account.json",
|
|
271
|
+
destinations: [
|
|
272
|
+
{
|
|
273
|
+
operatingAccount: {
|
|
274
|
+
accountId: "123-456-7890",
|
|
275
|
+
accountType: "GOOGLE_ADS"
|
|
276
|
+
},
|
|
277
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
data: {
|
|
282
|
+
map: {
|
|
283
|
+
email: "user.id",
|
|
284
|
+
phone: "data.phone",
|
|
285
|
+
firstName: "data.firstName",
|
|
286
|
+
lastName: "data.lastName",
|
|
287
|
+
regionCode: "data.country",
|
|
288
|
+
postalCode: "data.zip"
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
mapping
|
|
292
|
+
};
|
|
293
|
+
export {
|
|
294
|
+
auth_exports as auth,
|
|
295
|
+
basic_exports as basic,
|
|
296
|
+
mapping_exports as mapping
|
|
297
|
+
};
|