@pipedream/google_ads 0.2.0 → 0.3.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/actions/add-contact-to-list-by-email/add-contact-to-list-by-email.mjs +1 -1
- package/actions/create-customer-list/create-customer-list.mjs +1 -1
- package/actions/create-report/common-constants.mjs +55 -0
- package/actions/create-report/create-report.mjs +127 -17
- package/actions/send-offline-conversion/send-offline-conversion.mjs +1 -1
- package/common/queries.mjs +18 -2
- package/common/resources/ad.mjs +5 -9
- package/common/resources/adGroup.mjs +5 -9
- package/common/resources/campaign.mjs +5 -9
- package/common/resources/customer.mjs +5 -9
- package/common/utils.mjs +16 -0
- package/google_ads.app.mjs +29 -9
- package/package.json +1 -1
- package/sources/new-campaign-created/new-campaign-created.mjs +3 -3
- package/sources/new-lead-form-entry/new-lead-form-entry.mjs +1 -1
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
key: "google_ads-add-contact-to-list-by-email",
|
|
8
8
|
name: "Add Contact to Customer List by Email",
|
|
9
9
|
description: "Adds a contact to a specific customer list in Google Ads. Lists typically update in 6 to 12 hours after operation. [See the documentation](https://developers.google.com/google-ads/api/docs/remarketing/audience-segments/customer-match/get-started)",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.1",
|
|
11
11
|
type: "action",
|
|
12
12
|
props: {
|
|
13
13
|
...common.props,
|
|
@@ -16,7 +16,7 @@ export default {
|
|
|
16
16
|
name: "Create Customer List",
|
|
17
17
|
description:
|
|
18
18
|
"Create a new customer list in Google Ads. [See the documentation](https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList)",
|
|
19
|
-
version: "0.0.
|
|
19
|
+
version: "0.0.2",
|
|
20
20
|
type: "action",
|
|
21
21
|
props: {
|
|
22
22
|
...common.props,
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const DATE_RANGE_OPTIONS = [
|
|
2
|
+
{
|
|
3
|
+
value: "CUSTOM",
|
|
4
|
+
label: "Specify a custom date range",
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
value: "TODAY",
|
|
8
|
+
label: "Today only",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
value: "YESTERDAY",
|
|
12
|
+
label: "Yesterday only",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
value: "LAST_7_DAYS",
|
|
16
|
+
label: "The last 7 days not including today",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: "LAST_BUSINESS_WEEK",
|
|
20
|
+
label:
|
|
21
|
+
"The 5 day business week, Monday through Friday, of the previous business week",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: "THIS_MONTH",
|
|
25
|
+
label: "All days in the current month",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: "LAST_MONTH",
|
|
29
|
+
label: "All days in the previous month",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: "LAST_14_DAYS",
|
|
33
|
+
label: "The last 14 days not including today",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: "LAST_30_DAYS",
|
|
37
|
+
label: "The last 30 days not including today",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
value: "THIS_WEEK_SUN_TODAY",
|
|
41
|
+
label: "The period between the previous Sunday and the current day",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
value: "THIS_WEEK_MON_TODAY",
|
|
45
|
+
label: "The period between the previous Monday and the current day",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: "LAST_WEEK_SUN_SAT",
|
|
49
|
+
label: "The 7-day period starting with the previous Sunday",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: "LAST_WEEK_MON_SUN",
|
|
53
|
+
label: "The 7-day period starting with the previous Monday",
|
|
54
|
+
},
|
|
55
|
+
];
|
|
@@ -4,6 +4,8 @@ import { ad } from "../../common/resources/ad.mjs";
|
|
|
4
4
|
import { campaign } from "../../common/resources/campaign.mjs";
|
|
5
5
|
import { customer } from "../../common/resources/customer.mjs";
|
|
6
6
|
import { ConfigurationError } from "@pipedream/platform";
|
|
7
|
+
import { DATE_RANGE_OPTIONS } from "./common-constants.mjs";
|
|
8
|
+
import { checkPrefix } from "../../common/utils.mjs";
|
|
7
9
|
|
|
8
10
|
const RESOURCES = [
|
|
9
11
|
adGroup,
|
|
@@ -17,7 +19,7 @@ export default {
|
|
|
17
19
|
key: "google_ads-create-report",
|
|
18
20
|
name: "Create Report",
|
|
19
21
|
description: "Generates a report from your Google Ads data. [See the documentation](https://developers.google.com/google-ads/api/fields/v16/overview)",
|
|
20
|
-
version: "0.0
|
|
22
|
+
version: "0.1.0",
|
|
21
23
|
type: "action",
|
|
22
24
|
props: {
|
|
23
25
|
...common.props,
|
|
@@ -43,10 +45,60 @@ export default {
|
|
|
43
45
|
alertType: "info",
|
|
44
46
|
content: `[See the documentation](https://developers.google.com/google-ads/api/fields/v16/${value}) for more information on available fields, segments and metrics.`,
|
|
45
47
|
},
|
|
48
|
+
objectFilter: {
|
|
49
|
+
type: "string[]",
|
|
50
|
+
label: `Filter by ${label}s`,
|
|
51
|
+
description: `Select the ${label}s to generate a report for (or leave blank for all ${label}s)`,
|
|
52
|
+
optional: true,
|
|
53
|
+
useQuery: true,
|
|
54
|
+
options: async ({
|
|
55
|
+
query, prevContext: { nextPageToken: pageToken },
|
|
56
|
+
}) => {
|
|
57
|
+
const {
|
|
58
|
+
accountId, customerClientId, resource,
|
|
59
|
+
} = this;
|
|
60
|
+
const {
|
|
61
|
+
results, nextPageToken,
|
|
62
|
+
} = await this.googleAds.listResources({
|
|
63
|
+
accountId,
|
|
64
|
+
customerClientId,
|
|
65
|
+
resource,
|
|
66
|
+
query,
|
|
67
|
+
pageToken,
|
|
68
|
+
});
|
|
69
|
+
const options = results?.map?.((item) => this.getResourceOption(item, resource));
|
|
70
|
+
return {
|
|
71
|
+
options,
|
|
72
|
+
context: {
|
|
73
|
+
nextPageToken,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
dateRange: {
|
|
79
|
+
type: "string",
|
|
80
|
+
label: "Date Range",
|
|
81
|
+
description: "Select a date range for the report",
|
|
82
|
+
options: DATE_RANGE_OPTIONS,
|
|
83
|
+
optional: true,
|
|
84
|
+
reloadProps: true,
|
|
85
|
+
},
|
|
86
|
+
...(this.dateRange === "CUSTOM" && {
|
|
87
|
+
startDate: {
|
|
88
|
+
type: "string",
|
|
89
|
+
label: "Start Date",
|
|
90
|
+
description: "The start date, in `YYYY-MM-DD` format",
|
|
91
|
+
},
|
|
92
|
+
endDate: {
|
|
93
|
+
type: "string",
|
|
94
|
+
label: "End Date",
|
|
95
|
+
description: "The end date, in `YYYY-MM-DD` format",
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
46
98
|
fields: {
|
|
47
99
|
type: "string[]",
|
|
48
100
|
label: "Fields",
|
|
49
|
-
description:
|
|
101
|
+
description: "Select any fields you want to include in your report.",
|
|
50
102
|
options: resource.fields,
|
|
51
103
|
optional: true,
|
|
52
104
|
reloadProps: true,
|
|
@@ -54,15 +106,18 @@ export default {
|
|
|
54
106
|
segments: {
|
|
55
107
|
type: "string[]",
|
|
56
108
|
label: "Segments",
|
|
57
|
-
description:
|
|
109
|
+
description: "Select any segments you want to include in your report. See the documentation [here](https://developers.google.com/google-ads/api/fields/v16/segments)",
|
|
58
110
|
options: resource.segments,
|
|
111
|
+
default: [
|
|
112
|
+
"segments.date",
|
|
113
|
+
],
|
|
59
114
|
optional: true,
|
|
60
115
|
reloadProps: true,
|
|
61
116
|
},
|
|
62
117
|
metrics: {
|
|
63
118
|
type: "string[]",
|
|
64
119
|
label: "Metrics",
|
|
65
|
-
description:
|
|
120
|
+
description: "Select any metrics you want to include in your report. See the documentation [here](https://developers.google.com/google-ads/api/fields/v16/metrics)",
|
|
66
121
|
options: resource.metrics,
|
|
67
122
|
optional: true,
|
|
68
123
|
reloadProps: true,
|
|
@@ -73,10 +128,20 @@ export default {
|
|
|
73
128
|
description: "The field to order the results by",
|
|
74
129
|
optional: true,
|
|
75
130
|
options: [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
]
|
|
131
|
+
this.fields,
|
|
132
|
+
this.segments,
|
|
133
|
+
this.metrics,
|
|
134
|
+
].filter((v) => v).flatMap((value) => {
|
|
135
|
+
let returnValue = value;
|
|
136
|
+
if (typeof value === "string") {
|
|
137
|
+
try {
|
|
138
|
+
returnValue = JSON.parse(value);
|
|
139
|
+
} catch (err) {
|
|
140
|
+
returnValue = value.split(",");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return returnValue?.map?.((str) => str.trim());
|
|
144
|
+
}),
|
|
80
145
|
},
|
|
81
146
|
direction: {
|
|
82
147
|
type: "string",
|
|
@@ -104,17 +169,48 @@ export default {
|
|
|
104
169
|
};
|
|
105
170
|
},
|
|
106
171
|
methods: {
|
|
172
|
+
getResourceOption(item, resource) {
|
|
173
|
+
let label, value;
|
|
174
|
+
switch (resource) {
|
|
175
|
+
case "campaign":
|
|
176
|
+
label = item.campaign.name;
|
|
177
|
+
value = item.campaign.id;
|
|
178
|
+
break;
|
|
179
|
+
|
|
180
|
+
case "customer":
|
|
181
|
+
label = item.customer.descriptiveName;
|
|
182
|
+
value = item.customer.id;
|
|
183
|
+
break;
|
|
184
|
+
|
|
185
|
+
case "ad_group":
|
|
186
|
+
label = item.adGroup.name;
|
|
187
|
+
value = item.adGroup.id;
|
|
188
|
+
break;
|
|
189
|
+
|
|
190
|
+
case "ad_group_ad":
|
|
191
|
+
label = item.adGroupAd.ad.name;
|
|
192
|
+
value = item.adGroupAd.ad.id;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
label,
|
|
198
|
+
value,
|
|
199
|
+
};
|
|
200
|
+
},
|
|
107
201
|
buildQuery() {
|
|
108
202
|
const {
|
|
109
|
-
resource, limit, orderBy, direction,
|
|
203
|
+
resource, fields, segments, metrics, limit, orderBy, direction, objectFilter, dateRange,
|
|
110
204
|
} = this;
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
205
|
+
|
|
206
|
+
const filteredSegments = dateRange
|
|
207
|
+
? segments
|
|
208
|
+
: segments?.filter((i) => i !== "segments.date");
|
|
209
|
+
|
|
114
210
|
const selection = [
|
|
115
|
-
...fields,
|
|
116
|
-
...segments,
|
|
117
|
-
...metrics,
|
|
211
|
+
...checkPrefix(fields, resource),
|
|
212
|
+
...checkPrefix(filteredSegments, "segments"),
|
|
213
|
+
...checkPrefix(metrics, "metrics"),
|
|
118
214
|
];
|
|
119
215
|
|
|
120
216
|
if (!selection.length) {
|
|
@@ -122,8 +218,22 @@ export default {
|
|
|
122
218
|
}
|
|
123
219
|
|
|
124
220
|
let query = `SELECT ${selection.join(", ")} FROM ${resource}`;
|
|
221
|
+
if (objectFilter) {
|
|
222
|
+
query += ` WHERE ${resource === "ad_group_ad"
|
|
223
|
+
? "ad_group_ad.ad"
|
|
224
|
+
: resource}.id IN (${objectFilter.join?.(", ") ?? objectFilter})`;
|
|
225
|
+
}
|
|
226
|
+
if (dateRange) {
|
|
227
|
+
const dateClause = dateRange === "CUSTOM"
|
|
228
|
+
? `BETWEEN '${this.startDate}' AND '${this.endDate}'`
|
|
229
|
+
: `DURING ${dateRange}`;
|
|
230
|
+
query += ` ${objectFilter
|
|
231
|
+
? "AND"
|
|
232
|
+
: "WHERE"} segments.date ${dateClause}`;
|
|
233
|
+
}
|
|
234
|
+
|
|
125
235
|
if (orderBy && direction) {
|
|
126
|
-
query += ` ORDER BY ${
|
|
236
|
+
query += ` ORDER BY ${orderBy} ${direction}`;
|
|
127
237
|
}
|
|
128
238
|
if (limit) {
|
|
129
239
|
query += ` LIMIT ${limit}`;
|
|
@@ -145,7 +255,7 @@ export default {
|
|
|
145
255
|
|
|
146
256
|
const { length } = results;
|
|
147
257
|
|
|
148
|
-
$.export("$summary", `
|
|
258
|
+
$.export("$summary", `Successfully obtained ${length} result${length === 1
|
|
149
259
|
? ""
|
|
150
260
|
: "s"}`);
|
|
151
261
|
return {
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
key: "google_ads-send-offline-conversion",
|
|
9
9
|
name: "Send Offline Conversion",
|
|
10
10
|
description: "Send an event from to Google Ads to track offline conversions. [See the documentation](https://developers.google.com/google-ads/api/rest/reference/rest/v16/ConversionAction)",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.2",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
...common.props,
|
package/common/queries.mjs
CHANGED
|
@@ -73,7 +73,7 @@ function listCampaigns({
|
|
|
73
73
|
const defaultFields = [
|
|
74
74
|
"id",
|
|
75
75
|
"name",
|
|
76
|
-
];
|
|
76
|
+
].map((s) => `campaign.${s}`);
|
|
77
77
|
if (typeof fields === "string") {
|
|
78
78
|
fields = fields.split(",").map((s) => s.trim());
|
|
79
79
|
}
|
|
@@ -91,7 +91,22 @@ function listCampaigns({
|
|
|
91
91
|
? ` WHERE ${savedIds.map((id) => `campaign.id != ${id}`).join(" AND ")}`
|
|
92
92
|
: "";
|
|
93
93
|
|
|
94
|
-
return `SELECT ${fields.
|
|
94
|
+
return `SELECT ${fields.join(", ")} FROM campaign${filter}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function listResources(resource, query) {
|
|
98
|
+
const name = resource === "customer"
|
|
99
|
+
? "descriptive_name"
|
|
100
|
+
: "name";
|
|
101
|
+
const fieldResource = resource === "ad_group_ad"
|
|
102
|
+
? "ad_group_ad.ad"
|
|
103
|
+
: resource;
|
|
104
|
+
|
|
105
|
+
let result = `SELECT ${fieldResource}.id, ${fieldResource}.${name} FROM ${resource}`;
|
|
106
|
+
if (query) {
|
|
107
|
+
result += ` WHERE ${fieldResource}.${name} LIKE '%${query}%'`;
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
95
110
|
}
|
|
96
111
|
|
|
97
112
|
export const QUERIES = {
|
|
@@ -101,5 +116,6 @@ export const QUERIES = {
|
|
|
101
116
|
listLeadForms,
|
|
102
117
|
listLeadFormSubmissionData,
|
|
103
118
|
listRemarketingActions,
|
|
119
|
+
listResources,
|
|
104
120
|
listUserLists,
|
|
105
121
|
};
|
package/common/resources/ad.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getOption } from "../utils.mjs";
|
|
2
|
+
|
|
1
3
|
const fields = [
|
|
2
4
|
"action_items",
|
|
3
5
|
"ad.added_by_google_ads",
|
|
@@ -213,7 +215,7 @@ const fields = [
|
|
|
213
215
|
"primary_status_reasons",
|
|
214
216
|
"resource_name",
|
|
215
217
|
"status",
|
|
216
|
-
];
|
|
218
|
+
].map((f) => getOption(f, "ad_group_ad"));
|
|
217
219
|
|
|
218
220
|
const segments = [
|
|
219
221
|
"ad_destination_type",
|
|
@@ -226,20 +228,14 @@ const segments = [
|
|
|
226
228
|
"conversion_lag_bucket",
|
|
227
229
|
"conversion_or_adjustment_lag_bucket",
|
|
228
230
|
"date",
|
|
229
|
-
"day_of_week",
|
|
230
231
|
"device",
|
|
231
232
|
"external_conversion_source",
|
|
232
233
|
"keyword.ad_group_criterion",
|
|
233
234
|
"keyword.info.match_type",
|
|
234
235
|
"keyword.info.text",
|
|
235
|
-
"month",
|
|
236
|
-
"month_of_year",
|
|
237
236
|
"new_versus_returning_customers",
|
|
238
|
-
"quarter",
|
|
239
237
|
"slot",
|
|
240
|
-
|
|
241
|
-
"year",
|
|
242
|
-
];
|
|
238
|
+
].map((f) => getOption(f, "segments"));
|
|
243
239
|
|
|
244
240
|
const metrics = [
|
|
245
241
|
"absolute_top_impression_percentage",
|
|
@@ -319,7 +315,7 @@ const metrics = [
|
|
|
319
315
|
"video_view_rate",
|
|
320
316
|
"video_views",
|
|
321
317
|
"view_through_conversions",
|
|
322
|
-
];
|
|
318
|
+
].map((f) => getOption(f, "metrics"));
|
|
323
319
|
|
|
324
320
|
const resourceOption = {
|
|
325
321
|
label: "Ad",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getOption } from "../utils.mjs";
|
|
2
|
+
|
|
1
3
|
const fields = [
|
|
2
4
|
"ad_rotation_mode",
|
|
3
5
|
"audience_setting.use_audience_grouped",
|
|
@@ -31,7 +33,7 @@ const fields = [
|
|
|
31
33
|
"tracking_url_template",
|
|
32
34
|
"type",
|
|
33
35
|
"url_custom_parameters",
|
|
34
|
-
];
|
|
36
|
+
].map((f) => getOption(f, "ad_group"));
|
|
35
37
|
|
|
36
38
|
const segments = [
|
|
37
39
|
"ad_destination_type",
|
|
@@ -47,18 +49,12 @@ const segments = [
|
|
|
47
49
|
"conversion_lag_bucket",
|
|
48
50
|
"conversion_or_adjustment_lag_bucket",
|
|
49
51
|
"date",
|
|
50
|
-
"day_of_week",
|
|
51
52
|
"device",
|
|
52
53
|
"external_conversion_source",
|
|
53
54
|
"hour",
|
|
54
|
-
"month",
|
|
55
|
-
"month_of_year",
|
|
56
55
|
"new_versus_returning_customers",
|
|
57
|
-
"quarter",
|
|
58
56
|
"slot",
|
|
59
|
-
|
|
60
|
-
"year",
|
|
61
|
-
];
|
|
57
|
+
].map((f) => getOption(f, "segments"));
|
|
62
58
|
|
|
63
59
|
const metrics = [
|
|
64
60
|
"absolute_top_impression_percentage",
|
|
@@ -159,7 +155,7 @@ const metrics = [
|
|
|
159
155
|
"video_view_rate",
|
|
160
156
|
"video_views",
|
|
161
157
|
"view_through_conversions",
|
|
162
|
-
];
|
|
158
|
+
].map((f) => getOption(f, "metrics"));
|
|
163
159
|
|
|
164
160
|
const resourceOption = {
|
|
165
161
|
label: "Ad Group",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getOption } from "../utils.mjs";
|
|
2
|
+
|
|
1
3
|
const fields = [
|
|
2
4
|
"accessible_bidding_strategy",
|
|
3
5
|
"ad_serving_optimization_status",
|
|
@@ -93,7 +95,7 @@ const fields = [
|
|
|
93
95
|
"vanity_pharma.vanity_pharma_display_url_mode",
|
|
94
96
|
"vanity_pharma.vanity_pharma_text",
|
|
95
97
|
"video_brand_safety_suitability",
|
|
96
|
-
];
|
|
98
|
+
].map((f) => getOption(f, "campaign"));
|
|
97
99
|
|
|
98
100
|
const segments = [
|
|
99
101
|
"ad_destination_type",
|
|
@@ -111,14 +113,10 @@ const segments = [
|
|
|
111
113
|
"conversion_or_adjustment_lag_bucket",
|
|
112
114
|
"conversion_value_rule_primary_dimension",
|
|
113
115
|
"date",
|
|
114
|
-
"day_of_week",
|
|
115
116
|
"device",
|
|
116
117
|
"external_conversion_source",
|
|
117
118
|
"hour",
|
|
118
|
-
"month",
|
|
119
|
-
"month_of_year",
|
|
120
119
|
"new_versus_returning_customers",
|
|
121
|
-
"quarter",
|
|
122
120
|
"recommendation_type",
|
|
123
121
|
"sk_ad_network_ad_event_type",
|
|
124
122
|
"sk_ad_network_attribution_credit",
|
|
@@ -130,9 +128,7 @@ const segments = [
|
|
|
130
128
|
"sk_ad_network_source_type",
|
|
131
129
|
"sk_ad_network_user_type",
|
|
132
130
|
"slot",
|
|
133
|
-
|
|
134
|
-
"year",
|
|
135
|
-
];
|
|
131
|
+
].map((f) => getOption(f, "segments"));
|
|
136
132
|
|
|
137
133
|
const metrics = [
|
|
138
134
|
"absolute_top_impression_percentage",
|
|
@@ -274,7 +270,7 @@ const metrics = [
|
|
|
274
270
|
"view_through_conversions_from_location_asset_other_engagement",
|
|
275
271
|
"view_through_conversions_from_location_asset_store_visits",
|
|
276
272
|
"view_through_conversions_from_location_asset_website",
|
|
277
|
-
];
|
|
273
|
+
].map((f) => getOption(f, "metrics"));
|
|
278
274
|
|
|
279
275
|
const resourceOption = {
|
|
280
276
|
label: "Campaign",
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getOption } from "../utils.mjs";
|
|
2
|
+
|
|
1
3
|
const fields = [
|
|
2
4
|
"auto_tagging_enabled",
|
|
3
5
|
"call_reporting_setting.call_conversion_action",
|
|
@@ -32,7 +34,7 @@ const fields = [
|
|
|
32
34
|
"time_zone",
|
|
33
35
|
"tracking_url_template",
|
|
34
36
|
"video_brand_safety_suitability",
|
|
35
|
-
];
|
|
37
|
+
].map((f) => getOption(f, "customer"));
|
|
36
38
|
|
|
37
39
|
const segments = [
|
|
38
40
|
"ad_network_type",
|
|
@@ -46,14 +48,10 @@ const segments = [
|
|
|
46
48
|
"conversion_or_adjustment_lag_bucket",
|
|
47
49
|
"conversion_value_rule_primary_dimension",
|
|
48
50
|
"date",
|
|
49
|
-
"day_of_week",
|
|
50
51
|
"device",
|
|
51
52
|
"external_conversion_source",
|
|
52
53
|
"hour",
|
|
53
|
-
"month",
|
|
54
|
-
"month_of_year",
|
|
55
54
|
"new_versus_returning_customers",
|
|
56
|
-
"quarter",
|
|
57
55
|
"recommendation_type",
|
|
58
56
|
"sk_ad_network_ad_event_type",
|
|
59
57
|
"sk_ad_network_attribution_credit",
|
|
@@ -65,9 +63,7 @@ const segments = [
|
|
|
65
63
|
"sk_ad_network_source_type",
|
|
66
64
|
"sk_ad_network_user_type",
|
|
67
65
|
"slot",
|
|
68
|
-
|
|
69
|
-
"year",
|
|
70
|
-
];
|
|
66
|
+
].map((f) => getOption(f, "segments"));
|
|
71
67
|
|
|
72
68
|
const metrics = [
|
|
73
69
|
"absolute_top_impression_percentage",
|
|
@@ -166,7 +162,7 @@ const metrics = [
|
|
|
166
162
|
"view_through_conversions_from_location_asset_other_engagement",
|
|
167
163
|
"view_through_conversions_from_location_asset_store_visits",
|
|
168
164
|
"view_through_conversions_from_location_asset_website",
|
|
169
|
-
];
|
|
165
|
+
].map((f) => getOption(f, "metrics"));
|
|
170
166
|
|
|
171
167
|
const resourceOption = {
|
|
172
168
|
label: "Customer",
|
package/common/utils.mjs
CHANGED
|
@@ -30,3 +30,19 @@ export function parseStringObject(value = "{}") {
|
|
|
30
30
|
**${err.toString()}**`);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
export function getOption(label, prefix) {
|
|
35
|
+
return {
|
|
36
|
+
label,
|
|
37
|
+
value: `${prefix}.${label}`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function checkPrefix(value, prefix) {
|
|
42
|
+
const checkStr = (s) => s && (s?.startsWith?.(prefix)
|
|
43
|
+
? s
|
|
44
|
+
: `${prefix}.${s}`);
|
|
45
|
+
return Array.isArray(value ?? [])
|
|
46
|
+
? (value ?? []).map(checkStr)
|
|
47
|
+
: checkStr(value);
|
|
48
|
+
}
|
package/google_ads.app.mjs
CHANGED
|
@@ -128,7 +128,7 @@ export default {
|
|
|
128
128
|
},
|
|
129
129
|
...args,
|
|
130
130
|
});
|
|
131
|
-
return response
|
|
131
|
+
return response;
|
|
132
132
|
},
|
|
133
133
|
async listAccessibleCustomers() {
|
|
134
134
|
const response = await this._makeRequest({
|
|
@@ -139,13 +139,15 @@ export default {
|
|
|
139
139
|
async listCustomerClients({
|
|
140
140
|
query, ...args
|
|
141
141
|
}) {
|
|
142
|
-
|
|
142
|
+
const { results } = await this.search({
|
|
143
143
|
query: QUERIES.listCustomerClients(query),
|
|
144
144
|
...args,
|
|
145
145
|
});
|
|
146
|
+
return results;
|
|
146
147
|
},
|
|
147
148
|
async createReport(args) {
|
|
148
|
-
|
|
149
|
+
const { results } = await this.search(args);
|
|
150
|
+
return results;
|
|
149
151
|
},
|
|
150
152
|
async createUserList(args) {
|
|
151
153
|
const response = await this._makeRequest({
|
|
@@ -156,44 +158,62 @@ export default {
|
|
|
156
158
|
return response;
|
|
157
159
|
},
|
|
158
160
|
async listUserLists(args) {
|
|
159
|
-
|
|
161
|
+
const { results } = await this.search({
|
|
160
162
|
query: QUERIES.listUserLists(),
|
|
161
163
|
...args,
|
|
162
164
|
});
|
|
165
|
+
return results;
|
|
163
166
|
},
|
|
164
167
|
async listConversionActions(args) {
|
|
165
|
-
|
|
168
|
+
const { results } = await this.search({
|
|
166
169
|
query: QUERIES.listConversionActions(),
|
|
167
170
|
...args,
|
|
168
171
|
});
|
|
172
|
+
return results;
|
|
169
173
|
},
|
|
170
174
|
async listRemarketingActions(args) {
|
|
171
|
-
|
|
175
|
+
const { results } = await this.search({
|
|
172
176
|
query: QUERIES.listRemarketingActions(),
|
|
173
177
|
...args,
|
|
174
178
|
});
|
|
179
|
+
return results;
|
|
175
180
|
},
|
|
176
181
|
async listLeadForms(args) {
|
|
177
|
-
|
|
182
|
+
const { results } = await this.search({
|
|
178
183
|
query: QUERIES.listLeadForms(),
|
|
179
184
|
...args,
|
|
180
185
|
});
|
|
186
|
+
return results;
|
|
181
187
|
},
|
|
182
188
|
async listCampaigns({
|
|
183
189
|
query, ...args
|
|
184
190
|
}) {
|
|
185
|
-
|
|
191
|
+
const { results } = await this.search({
|
|
186
192
|
query: QUERIES.listCampaigns(query),
|
|
187
193
|
...args,
|
|
188
194
|
});
|
|
195
|
+
return results;
|
|
196
|
+
},
|
|
197
|
+
async listResources({
|
|
198
|
+
resource, query, pageToken, ...args
|
|
199
|
+
}) {
|
|
200
|
+
return this.search({
|
|
201
|
+
query: QUERIES.listResources(resource, query),
|
|
202
|
+
params: {
|
|
203
|
+
pageSize: 100,
|
|
204
|
+
pageToken,
|
|
205
|
+
},
|
|
206
|
+
...args,
|
|
207
|
+
});
|
|
189
208
|
},
|
|
190
209
|
async getLeadFormData({
|
|
191
210
|
leadFormId, ...args
|
|
192
211
|
}) {
|
|
193
|
-
|
|
212
|
+
const { results } = await this.search({
|
|
194
213
|
query: QUERIES.listLeadFormSubmissionData(leadFormId),
|
|
195
214
|
...args,
|
|
196
215
|
});
|
|
216
|
+
return results;
|
|
197
217
|
},
|
|
198
218
|
async createConversionAction(args) {
|
|
199
219
|
const response = await this._makeRequest({
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
key: "google_ads-new-campaign-created",
|
|
8
8
|
name: "New Campaign Created",
|
|
9
9
|
description: "Emit new event when a new campaign is created. [See the documentation](https://developers.google.com/google-ads/api/fields/v16/campaign)",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.2",
|
|
11
11
|
type: "source",
|
|
12
12
|
dedupe: "unique",
|
|
13
13
|
sampleEmit,
|
|
@@ -24,8 +24,8 @@ export default {
|
|
|
24
24
|
options: campaign.fields,
|
|
25
25
|
optional: true,
|
|
26
26
|
default: [
|
|
27
|
-
"id",
|
|
28
|
-
"name",
|
|
27
|
+
"campaign.id",
|
|
28
|
+
"campaign.name",
|
|
29
29
|
],
|
|
30
30
|
},
|
|
31
31
|
},
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
key: "google_ads-new-lead-form-entry",
|
|
9
9
|
name: "New Lead Form Entry",
|
|
10
10
|
description: "Emit new event for new leads on a Lead Form. [See the documentation](https://developers.google.com/google-ads/api/fields/v16/lead_form_submission_data)",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.2",
|
|
12
12
|
type: "source",
|
|
13
13
|
dedupe: "unique",
|
|
14
14
|
sampleEmit,
|