@walkeros/server-destination-datamanager 0.3.1 → 0.4.1
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 +235 -0
- package/dist/dev.d.ts +235 -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 +104 -35
- package/dist/examples/index.d.ts +104 -35
- package/dist/examples/index.js +182 -88
- package/dist/examples/index.mjs +181 -88
- package/dist/index.d.mts +147 -138
- package/dist/index.d.ts +147 -138
- 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 +1 -1
- package/dist/schemas.d.ts +1 -1
- 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 +8 -7
package/dist/examples/index.mjs
CHANGED
|
@@ -4,89 +4,81 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/examples/
|
|
8
|
-
var
|
|
9
|
-
__export(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// Will be hashed automatically
|
|
30
|
-
// Attribution identifiers (captured by browser source from URL)
|
|
31
|
-
gclid: "context.gclid",
|
|
32
|
-
// Google Click ID
|
|
33
|
-
gbraid: "context.gbraid",
|
|
34
|
-
// iOS attribution
|
|
35
|
-
wbraid: "context.wbraid",
|
|
36
|
-
// Web-to-app
|
|
37
|
-
// Shopping cart data
|
|
38
|
-
cartData: {
|
|
39
|
-
map: {
|
|
40
|
-
items: {
|
|
41
|
-
loop: [
|
|
42
|
-
"nested",
|
|
43
|
-
{
|
|
44
|
-
condition: (entity) => isObject(entity) && entity.entity === "product",
|
|
45
|
-
map: {
|
|
46
|
-
merchantProductId: "data.id",
|
|
47
|
-
price: "data.price",
|
|
48
|
-
quantity: { key: "data.quantity", value: 1 }
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
}
|
|
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"
|
|
54
29
|
}
|
|
55
|
-
|
|
30
|
+
]
|
|
56
31
|
}
|
|
57
32
|
};
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
+
]
|
|
66
45
|
}
|
|
67
46
|
};
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
+
]
|
|
74
59
|
}
|
|
75
60
|
};
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
+
]
|
|
85
73
|
}
|
|
86
74
|
};
|
|
87
|
-
var
|
|
75
|
+
var customScopes = {
|
|
88
76
|
settings: {
|
|
89
|
-
|
|
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"],
|
|
90
82
|
destinations: [
|
|
91
83
|
{
|
|
92
84
|
operatingAccount: {
|
|
@@ -96,18 +88,7 @@ var userDataMapping = {
|
|
|
96
88
|
productDestinationId: "AW-CONVERSION-123"
|
|
97
89
|
}
|
|
98
90
|
]
|
|
99
|
-
}
|
|
100
|
-
data: {
|
|
101
|
-
map: {
|
|
102
|
-
email: "user.id",
|
|
103
|
-
phone: "data.phone",
|
|
104
|
-
firstName: "data.firstName",
|
|
105
|
-
lastName: "data.lastName",
|
|
106
|
-
regionCode: "data.country",
|
|
107
|
-
postalCode: "data.zip"
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
mapping
|
|
91
|
+
}
|
|
111
92
|
};
|
|
112
93
|
|
|
113
94
|
// src/examples/basic.ts
|
|
@@ -120,7 +101,10 @@ __export(basic_exports, {
|
|
|
120
101
|
});
|
|
121
102
|
var minimal = {
|
|
122
103
|
settings: {
|
|
123
|
-
|
|
104
|
+
credentials: {
|
|
105
|
+
client_email: "service-account@project.iam.gserviceaccount.com",
|
|
106
|
+
private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
|
|
107
|
+
},
|
|
124
108
|
destinations: [
|
|
125
109
|
{
|
|
126
110
|
operatingAccount: {
|
|
@@ -134,7 +118,10 @@ var minimal = {
|
|
|
134
118
|
};
|
|
135
119
|
var complete = {
|
|
136
120
|
settings: {
|
|
137
|
-
|
|
121
|
+
credentials: {
|
|
122
|
+
client_email: "service-account@project.iam.gserviceaccount.com",
|
|
123
|
+
private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
|
|
124
|
+
},
|
|
138
125
|
destinations: [
|
|
139
126
|
{
|
|
140
127
|
operatingAccount: {
|
|
@@ -178,7 +165,6 @@ var complete = {
|
|
|
178
165
|
};
|
|
179
166
|
var ga4 = {
|
|
180
167
|
settings: {
|
|
181
|
-
accessToken: "ya29.c.xxx",
|
|
182
168
|
destinations: [
|
|
183
169
|
{
|
|
184
170
|
operatingAccount: {
|
|
@@ -193,7 +179,7 @@ var ga4 = {
|
|
|
193
179
|
};
|
|
194
180
|
var debug = {
|
|
195
181
|
settings: {
|
|
196
|
-
|
|
182
|
+
keyFilename: "./service-account.json",
|
|
197
183
|
destinations: [
|
|
198
184
|
{
|
|
199
185
|
operatingAccount: {
|
|
@@ -207,7 +193,114 @@ var debug = {
|
|
|
207
193
|
// Shows all API calls and responses
|
|
208
194
|
}
|
|
209
195
|
};
|
|
196
|
+
|
|
197
|
+
// src/examples/mapping.ts
|
|
198
|
+
var mapping_exports = {};
|
|
199
|
+
__export(mapping_exports, {
|
|
200
|
+
Lead: () => Lead,
|
|
201
|
+
PageView: () => PageView,
|
|
202
|
+
Purchase: () => Purchase,
|
|
203
|
+
mapping: () => mapping,
|
|
204
|
+
userDataMapping: () => userDataMapping
|
|
205
|
+
});
|
|
206
|
+
import { isObject } from "@walkeros/core";
|
|
207
|
+
var Purchase = {
|
|
208
|
+
name: "purchase",
|
|
209
|
+
data: {
|
|
210
|
+
map: {
|
|
211
|
+
// Required fields
|
|
212
|
+
transactionId: "data.id",
|
|
213
|
+
conversionValue: "data.total",
|
|
214
|
+
currency: { key: "data.currency", value: "USD" },
|
|
215
|
+
eventName: { value: "purchase" },
|
|
216
|
+
// User identification
|
|
217
|
+
userId: "user.id",
|
|
218
|
+
email: "user.id",
|
|
219
|
+
// Will be hashed automatically
|
|
220
|
+
// Attribution identifiers (captured by browser source from URL)
|
|
221
|
+
gclid: "context.gclid",
|
|
222
|
+
// Google Click ID
|
|
223
|
+
gbraid: "context.gbraid",
|
|
224
|
+
// iOS attribution
|
|
225
|
+
wbraid: "context.wbraid",
|
|
226
|
+
// Web-to-app
|
|
227
|
+
// Shopping cart data
|
|
228
|
+
cartData: {
|
|
229
|
+
map: {
|
|
230
|
+
items: {
|
|
231
|
+
loop: [
|
|
232
|
+
"nested",
|
|
233
|
+
{
|
|
234
|
+
condition: (entity) => isObject(entity) && entity.entity === "product",
|
|
235
|
+
map: {
|
|
236
|
+
merchantProductId: "data.id",
|
|
237
|
+
price: "data.price",
|
|
238
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
var Lead = {
|
|
249
|
+
name: "generate_lead",
|
|
250
|
+
data: {
|
|
251
|
+
map: {
|
|
252
|
+
eventName: { value: "generate_lead" },
|
|
253
|
+
conversionValue: { value: 10 },
|
|
254
|
+
currency: { value: "USD" }
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
var PageView = {
|
|
259
|
+
name: "page_view",
|
|
260
|
+
data: {
|
|
261
|
+
map: {
|
|
262
|
+
eventName: { value: "page_view" }
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
var mapping = {
|
|
267
|
+
order: {
|
|
268
|
+
complete: Purchase
|
|
269
|
+
},
|
|
270
|
+
lead: {
|
|
271
|
+
submit: Lead
|
|
272
|
+
},
|
|
273
|
+
page: {
|
|
274
|
+
view: PageView
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
var userDataMapping = {
|
|
278
|
+
settings: {
|
|
279
|
+
keyFilename: "./service-account.json",
|
|
280
|
+
destinations: [
|
|
281
|
+
{
|
|
282
|
+
operatingAccount: {
|
|
283
|
+
accountId: "123-456-7890",
|
|
284
|
+
accountType: "GOOGLE_ADS"
|
|
285
|
+
},
|
|
286
|
+
productDestinationId: "AW-CONVERSION-123"
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
data: {
|
|
291
|
+
map: {
|
|
292
|
+
email: "user.id",
|
|
293
|
+
phone: "data.phone",
|
|
294
|
+
firstName: "data.firstName",
|
|
295
|
+
lastName: "data.lastName",
|
|
296
|
+
regionCode: "data.country",
|
|
297
|
+
postalCode: "data.zip"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
mapping
|
|
301
|
+
};
|
|
210
302
|
export {
|
|
303
|
+
auth_exports as auth,
|
|
211
304
|
basic_exports as basic,
|
|
212
305
|
mapping_exports as mapping
|
|
213
306
|
};
|