@walkeros/server-destination-datamanager 0.4.0 → 0.4.2
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 +186 -41
- package/dist/dev.d.mts +111 -43
- package/dist/dev.d.ts +111 -43
- 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 +105 -40
- package/dist/examples/index.d.ts +105 -40
- package/dist/examples/index.js +184 -99
- package/dist/examples/index.mjs +183 -99
- package/dist/index.d.mts +127 -34
- package/dist/index.d.ts +127 -34
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/schemas.d.mts +4 -3
- package/dist/schemas.d.ts +4 -3
- package/dist/schemas.js +1 -1
- package/dist/schemas.js.map +1 -1
- package/dist/schemas.mjs +1 -1
- package/dist/schemas.mjs.map +1 -1
- package/package.json +7 -6
package/dist/examples/index.js
CHANGED
|
@@ -20,94 +20,87 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/examples/index.ts
|
|
21
21
|
var examples_exports = {};
|
|
22
22
|
__export(examples_exports, {
|
|
23
|
+
auth: () => auth_exports,
|
|
23
24
|
basic: () => basic_exports,
|
|
24
25
|
mapping: () => mapping_exports
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(examples_exports);
|
|
27
28
|
|
|
28
|
-
// src/examples/
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
36
37
|
});
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// Will be hashed automatically
|
|
51
|
-
// Attribution identifiers (captured by browser source from URL)
|
|
52
|
-
gclid: "context.gclid",
|
|
53
|
-
// Google Click ID
|
|
54
|
-
gbraid: "context.gbraid",
|
|
55
|
-
// iOS attribution
|
|
56
|
-
wbraid: "context.wbraid",
|
|
57
|
-
// Web-to-app
|
|
58
|
-
// Shopping cart data
|
|
59
|
-
cartData: {
|
|
60
|
-
map: {
|
|
61
|
-
items: {
|
|
62
|
-
loop: [
|
|
63
|
-
"nested",
|
|
64
|
-
{
|
|
65
|
-
condition: (entity) => (0, import_core.isObject)(entity) && entity.entity === "product",
|
|
66
|
-
map: {
|
|
67
|
-
merchantProductId: "data.id",
|
|
68
|
-
price: "data.price",
|
|
69
|
-
quantity: { key: "data.quantity", value: 1 }
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
}
|
|
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"
|
|
75
51
|
}
|
|
76
|
-
|
|
52
|
+
]
|
|
77
53
|
}
|
|
78
54
|
};
|
|
79
|
-
var
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
+
]
|
|
87
67
|
}
|
|
88
68
|
};
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
+
]
|
|
95
81
|
}
|
|
96
82
|
};
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
+
]
|
|
106
95
|
}
|
|
107
96
|
};
|
|
108
|
-
var
|
|
97
|
+
var customScopes = {
|
|
109
98
|
settings: {
|
|
110
|
-
|
|
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"],
|
|
111
104
|
destinations: [
|
|
112
105
|
{
|
|
113
106
|
operatingAccount: {
|
|
@@ -117,18 +110,7 @@ var userDataMapping = {
|
|
|
117
110
|
productDestinationId: "AW-CONVERSION-123"
|
|
118
111
|
}
|
|
119
112
|
]
|
|
120
|
-
}
|
|
121
|
-
data: {
|
|
122
|
-
map: {
|
|
123
|
-
email: "user.id",
|
|
124
|
-
phone: "data.phone",
|
|
125
|
-
firstName: "data.firstName",
|
|
126
|
-
lastName: "data.lastName",
|
|
127
|
-
regionCode: "data.country",
|
|
128
|
-
postalCode: "data.zip"
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
mapping
|
|
113
|
+
}
|
|
132
114
|
};
|
|
133
115
|
|
|
134
116
|
// src/examples/basic.ts
|
|
@@ -141,7 +123,10 @@ __export(basic_exports, {
|
|
|
141
123
|
});
|
|
142
124
|
var minimal = {
|
|
143
125
|
settings: {
|
|
144
|
-
|
|
126
|
+
credentials: {
|
|
127
|
+
client_email: "service-account@project.iam.gserviceaccount.com",
|
|
128
|
+
private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
|
|
129
|
+
},
|
|
145
130
|
destinations: [
|
|
146
131
|
{
|
|
147
132
|
operatingAccount: {
|
|
@@ -155,7 +140,10 @@ var minimal = {
|
|
|
155
140
|
};
|
|
156
141
|
var complete = {
|
|
157
142
|
settings: {
|
|
158
|
-
|
|
143
|
+
credentials: {
|
|
144
|
+
client_email: "service-account@project.iam.gserviceaccount.com",
|
|
145
|
+
private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
|
|
146
|
+
},
|
|
159
147
|
destinations: [
|
|
160
148
|
{
|
|
161
149
|
operatingAccount: {
|
|
@@ -172,7 +160,6 @@ var complete = {
|
|
|
172
160
|
productDestinationId: "G-XXXXXXXXXX"
|
|
173
161
|
}
|
|
174
162
|
],
|
|
175
|
-
eventSource: "WEB",
|
|
176
163
|
batchSize: 100,
|
|
177
164
|
batchInterval: 5e3,
|
|
178
165
|
validateOnly: false,
|
|
@@ -190,16 +177,10 @@ var complete = {
|
|
|
190
177
|
userId: "user.id",
|
|
191
178
|
clientId: "user.device",
|
|
192
179
|
sessionAttributes: "context.sessionAttributes"
|
|
193
|
-
},
|
|
194
|
-
data: {
|
|
195
|
-
map: {
|
|
196
|
-
eventSource: { value: "WEB" }
|
|
197
|
-
}
|
|
198
180
|
}
|
|
199
181
|
};
|
|
200
182
|
var ga4 = {
|
|
201
183
|
settings: {
|
|
202
|
-
accessToken: "ya29.c.xxx",
|
|
203
184
|
destinations: [
|
|
204
185
|
{
|
|
205
186
|
operatingAccount: {
|
|
@@ -208,13 +189,12 @@ var ga4 = {
|
|
|
208
189
|
},
|
|
209
190
|
productDestinationId: "G-XXXXXXXXXX"
|
|
210
191
|
}
|
|
211
|
-
]
|
|
212
|
-
eventSource: "WEB"
|
|
192
|
+
]
|
|
213
193
|
}
|
|
214
194
|
};
|
|
215
195
|
var debug = {
|
|
216
196
|
settings: {
|
|
217
|
-
|
|
197
|
+
keyFilename: "./service-account.json",
|
|
218
198
|
destinations: [
|
|
219
199
|
{
|
|
220
200
|
operatingAccount: {
|
|
@@ -223,13 +203,118 @@ var debug = {
|
|
|
223
203
|
},
|
|
224
204
|
productDestinationId: "AW-CONVERSION-123"
|
|
225
205
|
}
|
|
226
|
-
]
|
|
227
|
-
|
|
228
|
-
|
|
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
|
|
229
288
|
}
|
|
230
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
|
+
};
|
|
231
315
|
// Annotate the CommonJS export names for ESM import in node:
|
|
232
316
|
0 && (module.exports = {
|
|
317
|
+
auth,
|
|
233
318
|
basic,
|
|
234
319
|
mapping
|
|
235
320
|
});
|