@pipedream/google_ads 0.7.0 → 0.8.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-ad-group-report/create-ad-group-report.mjs +1 -1
- package/actions/create-ad-report/create-ad-report.mjs +1 -1
- package/actions/create-campaign-report/create-campaign-report.mjs +1 -1
- package/actions/create-customer-list/create-customer-list.mjs +1 -1
- package/actions/create-customer-report/create-customer-report.mjs +1 -1
- package/actions/create-or-remove-campaign-criteria/create-or-remove-campaign-criteria.mjs +214 -0
- package/actions/create-or-remove-campaign-shared-set/create-or-remove-campaign-shared-set.mjs +155 -0
- package/actions/create-or-remove-shared-criteria/create-or-remove-shared-criteria.mjs +180 -0
- package/actions/create-or-update-ad-group/create-or-update-ad-group.mjs +315 -0
- package/actions/create-or-update-ad-group-ad/create-or-update-ad-group-ad.mjs +203 -0
- package/actions/create-or-update-bidding-strategy/create-or-update-bidding-strategy.mjs +180 -0
- package/actions/create-or-update-campaign/create-or-update-campaign.mjs +243 -0
- package/actions/create-or-update-campaign-budget/create-or-update-campaign-budget.mjs +212 -0
- package/actions/create-or-update-keywords/create-or-update-keywords.mjs +275 -0
- package/actions/create-or-update-shared-sets/create-or-update-shared-sets.mjs +180 -0
- package/actions/create-report/create-report.mjs +1 -1
- package/actions/create-responsive-search-ad/create-responsive-search-ad.mjs +202 -0
- package/actions/generate-keyword-ideas/generate-keyword-ideas.mjs +1 -1
- package/actions/get-keyword-quality-scores/get-keyword-quality-scores.mjs +107 -0
- package/actions/list-account-id-options/list-account-id-options.mjs +1 -1
- package/actions/list-ad-group-ads/list-ad-group-ads.mjs +55 -0
- package/actions/list-ad-group-criteria/list-ad-group-criteria.mjs +55 -0
- package/actions/list-ad-groups/list-ad-groups.mjs +55 -0
- package/actions/list-bidding-strategies/list-bidding-strategies.mjs +55 -0
- package/actions/list-campaign-budgets/list-campaign-budgets.mjs +55 -0
- package/actions/list-campaign-criteria/list-campaign-criteria.mjs +55 -0
- package/actions/list-campaign-shared-sets/list-campaign-shared-sets.mjs +55 -0
- package/actions/list-campaigns/list-campaigns.mjs +55 -0
- package/actions/list-customer-clients/list-customer-clients.mjs +1 -1
- package/actions/list-keywords/list-keywords.mjs +55 -0
- package/actions/list-shared-criteria/list-shared-criteria.mjs +55 -0
- package/actions/list-shared-sets/list-shared-sets.mjs +55 -0
- package/actions/send-offline-conversion/send-offline-conversion.mjs +1 -1
- package/actions/update-campaign-ai-max-settings/update-campaign-ai-max-settings.mjs +167 -0
- package/common/constants.mjs +269 -0
- package/common/queries.mjs +4 -2
- package/common/utils.mjs +4 -0
- package/google_ads.app.mjs +589 -1
- package/package.json +1 -1
- package/sources/new-campaign-created/new-campaign-created.mjs +1 -1
- package/sources/new-lead-form-entry/new-lead-form-entry.mjs +1 -1
package/google_ads.app.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { axios } from "@pipedream/platform";
|
|
2
2
|
import { CORE_DATE_SEGMENTS } from "./common/constants.mjs";
|
|
3
3
|
import { QUERIES } from "./common/queries.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
getResourceOption, sanitizeGaqlString,
|
|
6
|
+
} from "./common/utils.mjs";
|
|
5
7
|
|
|
6
8
|
export default {
|
|
7
9
|
type: "app",
|
|
@@ -124,6 +126,313 @@ export default {
|
|
|
124
126
|
.filter((v) => dateRange || !CORE_DATE_SEGMENTS.includes(v));
|
|
125
127
|
},
|
|
126
128
|
},
|
|
129
|
+
campaignId: {
|
|
130
|
+
type: "string",
|
|
131
|
+
label: "Campaign",
|
|
132
|
+
description: "Numeric campaign ID (e.g., `1234567890`). Use the **List Campaigns** action to discover valid IDs.",
|
|
133
|
+
useQuery: true,
|
|
134
|
+
async options({
|
|
135
|
+
accountId, customerClientId, query, prevContext,
|
|
136
|
+
}) {
|
|
137
|
+
const pageToken = prevContext?.nextPageToken;
|
|
138
|
+
const {
|
|
139
|
+
results, nextPageToken,
|
|
140
|
+
} = await this.listResources({
|
|
141
|
+
accountId,
|
|
142
|
+
customerClientId,
|
|
143
|
+
resource: "campaign",
|
|
144
|
+
query,
|
|
145
|
+
pageToken,
|
|
146
|
+
});
|
|
147
|
+
const options = results?.map?.((item) => this.getResourceOption(item, "campaign")) ?? [];
|
|
148
|
+
return {
|
|
149
|
+
options,
|
|
150
|
+
context: {
|
|
151
|
+
nextPageToken,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
campaignSharedSetId: {
|
|
157
|
+
type: "string",
|
|
158
|
+
label: "Campaign Shared Set",
|
|
159
|
+
description: "Campaign shared set resource name (e.g., `customers/123/campaignSharedSets/456~789`). Use the **List Campaign Shared Sets** action to discover valid values.",
|
|
160
|
+
useQuery: true,
|
|
161
|
+
async options({
|
|
162
|
+
accountId, customerClientId, query, prevContext,
|
|
163
|
+
}) {
|
|
164
|
+
const pageToken = prevContext?.nextPageToken;
|
|
165
|
+
const {
|
|
166
|
+
results, nextPageToken,
|
|
167
|
+
} = await this.listCampaignSharedSets({
|
|
168
|
+
accountId,
|
|
169
|
+
customerClientId,
|
|
170
|
+
query,
|
|
171
|
+
pageToken,
|
|
172
|
+
});
|
|
173
|
+
const options = results?.map?.((item) => ({
|
|
174
|
+
label: `${item.campaign?.name} → ${item.sharedSet?.name}`,
|
|
175
|
+
value: item.campaignSharedSet?.resourceName,
|
|
176
|
+
})) ?? [];
|
|
177
|
+
return {
|
|
178
|
+
options,
|
|
179
|
+
context: {
|
|
180
|
+
nextPageToken,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
sharedCriterionId: {
|
|
186
|
+
type: "string",
|
|
187
|
+
label: "Shared Criterion",
|
|
188
|
+
description: "Shared criterion resource name (e.g., `customers/123/sharedCriteria/456~789`). Use the **List Shared Criteria** action to discover valid values.",
|
|
189
|
+
useQuery: true,
|
|
190
|
+
async options({
|
|
191
|
+
accountId, customerClientId, query, prevContext,
|
|
192
|
+
}) {
|
|
193
|
+
const pageToken = prevContext?.nextPageToken;
|
|
194
|
+
const {
|
|
195
|
+
results, nextPageToken,
|
|
196
|
+
} = await this.listSharedCriteria({
|
|
197
|
+
accountId,
|
|
198
|
+
customerClientId,
|
|
199
|
+
query,
|
|
200
|
+
pageToken,
|
|
201
|
+
});
|
|
202
|
+
const options = results?.map?.((item) => {
|
|
203
|
+
const criterion = item.sharedCriterion;
|
|
204
|
+
const sharedSetName = item.sharedSet?.name;
|
|
205
|
+
let criterionLabel;
|
|
206
|
+
if (criterion?.type === "KEYWORD") {
|
|
207
|
+
criterionLabel = `[${criterion.keyword?.matchType}] ${criterion.keyword?.text}`;
|
|
208
|
+
} else {
|
|
209
|
+
criterionLabel = `[${criterion?.type}] ${criterion?.criterionId}`;
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
label: `${criterionLabel} (${sharedSetName})`,
|
|
213
|
+
value: criterion?.resourceName,
|
|
214
|
+
};
|
|
215
|
+
}) ?? [];
|
|
216
|
+
return {
|
|
217
|
+
options,
|
|
218
|
+
context: {
|
|
219
|
+
nextPageToken,
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
sharedSetId: {
|
|
225
|
+
type: "string",
|
|
226
|
+
label: "Shared Set",
|
|
227
|
+
description: "Numeric shared set ID (e.g., `1234567890`). Use the **List Shared Sets** action to discover valid IDs.",
|
|
228
|
+
useQuery: true,
|
|
229
|
+
async options({
|
|
230
|
+
accountId, customerClientId, query, prevContext,
|
|
231
|
+
}) {
|
|
232
|
+
const pageToken = prevContext?.nextPageToken;
|
|
233
|
+
const {
|
|
234
|
+
results, nextPageToken,
|
|
235
|
+
} = await this.listAllSharedSets({
|
|
236
|
+
accountId,
|
|
237
|
+
customerClientId,
|
|
238
|
+
query,
|
|
239
|
+
pageToken,
|
|
240
|
+
});
|
|
241
|
+
const options = results?.map?.((item) => ({
|
|
242
|
+
label: `[${item.sharedSet?.type}] ${item.sharedSet?.name}`,
|
|
243
|
+
value: item.sharedSet?.id,
|
|
244
|
+
})) ?? [];
|
|
245
|
+
return {
|
|
246
|
+
options,
|
|
247
|
+
context: {
|
|
248
|
+
nextPageToken,
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
adGroupCriterionId: {
|
|
254
|
+
type: "string",
|
|
255
|
+
label: "Keyword",
|
|
256
|
+
description: "Keyword criterion resource name (e.g., `customers/123/adGroupCriteria/456~789`). Use the **List Keywords** action to discover valid values.",
|
|
257
|
+
useQuery: true,
|
|
258
|
+
async options({
|
|
259
|
+
accountId, customerClientId, query, prevContext,
|
|
260
|
+
}) {
|
|
261
|
+
const pageToken = prevContext?.nextPageToken;
|
|
262
|
+
const {
|
|
263
|
+
results, nextPageToken,
|
|
264
|
+
} = await this.listKeywords({
|
|
265
|
+
accountId,
|
|
266
|
+
customerClientId,
|
|
267
|
+
query,
|
|
268
|
+
pageToken,
|
|
269
|
+
});
|
|
270
|
+
const options = results?.map?.((item) => ({
|
|
271
|
+
label: `[${item.adGroupCriterion?.keyword?.matchType}] ${item.adGroupCriterion?.keyword?.text}`,
|
|
272
|
+
value: item.adGroupCriterion?.resourceName,
|
|
273
|
+
})) ?? [];
|
|
274
|
+
return {
|
|
275
|
+
options,
|
|
276
|
+
context: {
|
|
277
|
+
nextPageToken,
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
adGroupAdId: {
|
|
283
|
+
type: "string",
|
|
284
|
+
label: "Ad Group Ad",
|
|
285
|
+
description: "Ad group ad resource name (e.g., `customers/123/adGroupAds/456~789`). Use the **List Ad Group Ads** action to discover valid values.",
|
|
286
|
+
useQuery: true,
|
|
287
|
+
async options({
|
|
288
|
+
accountId, customerClientId, query, prevContext,
|
|
289
|
+
}) {
|
|
290
|
+
const pageToken = prevContext?.nextPageToken;
|
|
291
|
+
const {
|
|
292
|
+
results, nextPageToken,
|
|
293
|
+
} = await this.listResources({
|
|
294
|
+
accountId,
|
|
295
|
+
customerClientId,
|
|
296
|
+
resource: "ad_group_ad",
|
|
297
|
+
query,
|
|
298
|
+
pageToken,
|
|
299
|
+
});
|
|
300
|
+
const options = results?.map?.((item) => ({
|
|
301
|
+
label: item.adGroupAd?.ad?.name ?? `Ad ${item.adGroupAd?.ad?.id}`,
|
|
302
|
+
value: item.adGroupAd?.resourceName,
|
|
303
|
+
})) ?? [];
|
|
304
|
+
return {
|
|
305
|
+
options,
|
|
306
|
+
context: {
|
|
307
|
+
nextPageToken,
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
adGroupId: {
|
|
313
|
+
type: "string",
|
|
314
|
+
label: "Ad Group",
|
|
315
|
+
description: "Numeric ad group ID (e.g., `1234567890`). Use the **List Ad Groups** action to discover valid IDs.",
|
|
316
|
+
useQuery: true,
|
|
317
|
+
async options({
|
|
318
|
+
accountId, customerClientId, query, prevContext,
|
|
319
|
+
}) {
|
|
320
|
+
const pageToken = prevContext?.nextPageToken;
|
|
321
|
+
const {
|
|
322
|
+
results, nextPageToken,
|
|
323
|
+
} = await this.listResources({
|
|
324
|
+
accountId,
|
|
325
|
+
customerClientId,
|
|
326
|
+
resource: "ad_group",
|
|
327
|
+
query,
|
|
328
|
+
pageToken,
|
|
329
|
+
});
|
|
330
|
+
const options = results?.map?.((item) => this.getResourceOption(item, "ad_group")) ?? [];
|
|
331
|
+
return {
|
|
332
|
+
options,
|
|
333
|
+
context: {
|
|
334
|
+
nextPageToken,
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
campaignBudgetId: {
|
|
340
|
+
type: "string",
|
|
341
|
+
label: "Campaign Budget",
|
|
342
|
+
description: "Numeric budget ID (e.g., `1234567890`). Use the **List Campaign Budgets** action to discover valid IDs.",
|
|
343
|
+
useQuery: true,
|
|
344
|
+
async options({
|
|
345
|
+
accountId, customerClientId, query, prevContext,
|
|
346
|
+
}) {
|
|
347
|
+
const pageToken = prevContext?.nextPageToken;
|
|
348
|
+
const {
|
|
349
|
+
results, nextPageToken,
|
|
350
|
+
} = await this.listAllCampaignBudgets({
|
|
351
|
+
accountId,
|
|
352
|
+
customerClientId,
|
|
353
|
+
query,
|
|
354
|
+
pageToken,
|
|
355
|
+
});
|
|
356
|
+
const options = results?.map?.((item) => ({
|
|
357
|
+
label: item.campaignBudget?.name ?? `Budget ${item.campaignBudget?.id}`,
|
|
358
|
+
value: item.campaignBudget?.id,
|
|
359
|
+
})) ?? [];
|
|
360
|
+
return {
|
|
361
|
+
options,
|
|
362
|
+
context: {
|
|
363
|
+
nextPageToken,
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
campaignCriterionId: {
|
|
369
|
+
type: "string",
|
|
370
|
+
label: "Campaign Criterion",
|
|
371
|
+
description: "Campaign criterion resource name (e.g., `customers/123/campaignCriteria/456~789`). Use the **List Campaign Criteria** action to discover valid values.",
|
|
372
|
+
useQuery: true,
|
|
373
|
+
async options({
|
|
374
|
+
accountId, customerClientId, query, prevContext,
|
|
375
|
+
}) {
|
|
376
|
+
const pageToken = prevContext?.nextPageToken;
|
|
377
|
+
const {
|
|
378
|
+
results, nextPageToken,
|
|
379
|
+
} = await this.listCampaignCriteria({
|
|
380
|
+
accountId,
|
|
381
|
+
customerClientId,
|
|
382
|
+
query,
|
|
383
|
+
pageToken,
|
|
384
|
+
});
|
|
385
|
+
const options = results?.map?.((item) => {
|
|
386
|
+
const criterion = item.campaignCriterion;
|
|
387
|
+
const campaignName = item.campaign?.name;
|
|
388
|
+
let criterionLabel;
|
|
389
|
+
if (criterion?.type === "KEYWORD") {
|
|
390
|
+
criterionLabel = `[${criterion.keyword?.matchType}] ${criterion.keyword?.text}`;
|
|
391
|
+
} else {
|
|
392
|
+
criterionLabel = `[${criterion?.type}] ${criterion?.criterionId}`;
|
|
393
|
+
}
|
|
394
|
+
return {
|
|
395
|
+
label: `${criterionLabel} (${campaignName})`,
|
|
396
|
+
value: criterion?.resourceName,
|
|
397
|
+
};
|
|
398
|
+
}) ?? [];
|
|
399
|
+
return {
|
|
400
|
+
options,
|
|
401
|
+
context: {
|
|
402
|
+
nextPageToken,
|
|
403
|
+
},
|
|
404
|
+
};
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
biddingStrategyId: {
|
|
408
|
+
type: "string",
|
|
409
|
+
label: "Bidding Strategy",
|
|
410
|
+
description: "Numeric bidding strategy ID (e.g., `1234567890`). Use the **List Bidding Strategies** action to discover valid IDs.",
|
|
411
|
+
useQuery: true,
|
|
412
|
+
async options({
|
|
413
|
+
accountId, customerClientId, query, prevContext,
|
|
414
|
+
}) {
|
|
415
|
+
const pageToken = prevContext?.nextPageToken;
|
|
416
|
+
const {
|
|
417
|
+
results, nextPageToken,
|
|
418
|
+
} = await this.listAllBiddingStrategies({
|
|
419
|
+
accountId,
|
|
420
|
+
customerClientId,
|
|
421
|
+
query,
|
|
422
|
+
pageToken,
|
|
423
|
+
});
|
|
424
|
+
const options = results?.map?.((item) => ({
|
|
425
|
+
label: `[${item.biddingStrategy?.type}] ${item.biddingStrategy?.name}`,
|
|
426
|
+
value: item.biddingStrategy?.id,
|
|
427
|
+
})) ?? [];
|
|
428
|
+
return {
|
|
429
|
+
options,
|
|
430
|
+
context: {
|
|
431
|
+
nextPageToken,
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
},
|
|
435
|
+
},
|
|
127
436
|
leadFormId: {
|
|
128
437
|
type: "string",
|
|
129
438
|
label: "Lead Form ID",
|
|
@@ -311,5 +620,284 @@ export default {
|
|
|
311
620
|
...opts,
|
|
312
621
|
});
|
|
313
622
|
},
|
|
623
|
+
async mutateCampaign(opts = {}) {
|
|
624
|
+
return this._makeRequest({
|
|
625
|
+
method: "POST",
|
|
626
|
+
path: "/v21/customers/{customerClientId}/campaigns:mutate",
|
|
627
|
+
...opts,
|
|
628
|
+
});
|
|
629
|
+
},
|
|
630
|
+
async mutateAdGroup(opts = {}) {
|
|
631
|
+
return this._makeRequest({
|
|
632
|
+
method: "POST",
|
|
633
|
+
path: "/v21/customers/{customerClientId}/adGroups:mutate",
|
|
634
|
+
...opts,
|
|
635
|
+
});
|
|
636
|
+
},
|
|
637
|
+
async listAllCampaigns({
|
|
638
|
+
query, pageToken, ...args
|
|
639
|
+
}) {
|
|
640
|
+
const filter = query
|
|
641
|
+
? ` WHERE campaign.name LIKE '%${sanitizeGaqlString(query)}%'`
|
|
642
|
+
: "";
|
|
643
|
+
return this.search({
|
|
644
|
+
query: `SELECT campaign.id, campaign.name, campaign.status, campaign.advertising_channel_type, campaign.start_date, campaign.end_date FROM campaign${filter}`,
|
|
645
|
+
params: {
|
|
646
|
+
pageToken,
|
|
647
|
+
},
|
|
648
|
+
...args,
|
|
649
|
+
});
|
|
650
|
+
},
|
|
651
|
+
async listAllAdGroups({
|
|
652
|
+
query, pageToken, ...args
|
|
653
|
+
}) {
|
|
654
|
+
const filter = query
|
|
655
|
+
? ` WHERE ad_group.name LIKE '%${sanitizeGaqlString(query)}%'`
|
|
656
|
+
: "";
|
|
657
|
+
return this.search({
|
|
658
|
+
query: `SELECT ad_group.id, ad_group.name, ad_group.status, ad_group.campaign, ad_group.type FROM ad_group${filter}`,
|
|
659
|
+
params: {
|
|
660
|
+
pageToken,
|
|
661
|
+
},
|
|
662
|
+
...args,
|
|
663
|
+
});
|
|
664
|
+
},
|
|
665
|
+
async listAllAdGroupAds({
|
|
666
|
+
query, pageToken, ...args
|
|
667
|
+
}) {
|
|
668
|
+
const filter = query
|
|
669
|
+
? ` WHERE ad_group_ad.ad.name LIKE '%${sanitizeGaqlString(query)}%'`
|
|
670
|
+
: "";
|
|
671
|
+
return this.search({
|
|
672
|
+
query: `SELECT ad_group_ad.resource_name, ad_group_ad.ad.id, ad_group_ad.ad.name, ad_group_ad.ad.type, ad_group_ad.status, ad_group.id, ad_group.name FROM ad_group_ad${filter}`,
|
|
673
|
+
params: {
|
|
674
|
+
pageToken,
|
|
675
|
+
},
|
|
676
|
+
...args,
|
|
677
|
+
});
|
|
678
|
+
},
|
|
679
|
+
async listAllKeywords({
|
|
680
|
+
query, pageToken, ...args
|
|
681
|
+
}) {
|
|
682
|
+
const filter = query
|
|
683
|
+
? ` AND ad_group_criterion.keyword.text LIKE '%${sanitizeGaqlString(query)}%'`
|
|
684
|
+
: "";
|
|
685
|
+
return this.search({
|
|
686
|
+
query: `SELECT ad_group_criterion.criterion_id, ad_group_criterion.resource_name, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.status, ad_group_criterion.cpc_bid_micros, ad_group_criterion.negative, ad_group.id, ad_group.name FROM ad_group_criterion WHERE ad_group_criterion.type = 'KEYWORD'${filter}`,
|
|
687
|
+
params: {
|
|
688
|
+
pageToken,
|
|
689
|
+
},
|
|
690
|
+
...args,
|
|
691
|
+
});
|
|
692
|
+
},
|
|
693
|
+
async listKeywords({
|
|
694
|
+
query, pageToken, ...args
|
|
695
|
+
}) {
|
|
696
|
+
const filter = query
|
|
697
|
+
? ` AND ad_group_criterion.keyword.text LIKE '%${sanitizeGaqlString(query)}%'`
|
|
698
|
+
: "";
|
|
699
|
+
return this.search({
|
|
700
|
+
query: `SELECT ad_group_criterion.resource_name, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type FROM ad_group_criterion WHERE ad_group_criterion.type = 'KEYWORD'${filter}`,
|
|
701
|
+
params: {
|
|
702
|
+
pageToken,
|
|
703
|
+
},
|
|
704
|
+
...args,
|
|
705
|
+
});
|
|
706
|
+
},
|
|
707
|
+
async mutateAdGroupCriteria(opts = {}) {
|
|
708
|
+
return this._makeRequest({
|
|
709
|
+
method: "POST",
|
|
710
|
+
path: "/v21/customers/{customerClientId}/adGroupCriteria:mutate",
|
|
711
|
+
...opts,
|
|
712
|
+
});
|
|
713
|
+
},
|
|
714
|
+
async mutateAdGroupAd(opts = {}) {
|
|
715
|
+
return this._makeRequest({
|
|
716
|
+
method: "POST",
|
|
717
|
+
path: "/v21/customers/{customerClientId}/adGroupAds:mutate",
|
|
718
|
+
...opts,
|
|
719
|
+
});
|
|
720
|
+
},
|
|
721
|
+
async listAllSharedSets({
|
|
722
|
+
query, pageToken, ...args
|
|
723
|
+
}) {
|
|
724
|
+
const filter = query
|
|
725
|
+
? ` AND shared_set.name LIKE '%${sanitizeGaqlString(query)}%'`
|
|
726
|
+
: "";
|
|
727
|
+
return this.search({
|
|
728
|
+
query: `SELECT shared_set.id, shared_set.name, shared_set.type, shared_set.status FROM shared_set WHERE shared_set.status = 'ENABLED'${filter}`,
|
|
729
|
+
params: {
|
|
730
|
+
pageToken,
|
|
731
|
+
},
|
|
732
|
+
...args,
|
|
733
|
+
});
|
|
734
|
+
},
|
|
735
|
+
async mutateSharedSets(opts = {}) {
|
|
736
|
+
return this._makeRequest({
|
|
737
|
+
method: "POST",
|
|
738
|
+
path: "/v21/customers/{customerClientId}/sharedSets:mutate",
|
|
739
|
+
...opts,
|
|
740
|
+
});
|
|
741
|
+
},
|
|
742
|
+
async listSharedCriteria({
|
|
743
|
+
query, pageToken, ...args
|
|
744
|
+
}) {
|
|
745
|
+
const filter = query
|
|
746
|
+
? ` AND shared_criterion.keyword.text LIKE '%${sanitizeGaqlString(query)}%'`
|
|
747
|
+
: "";
|
|
748
|
+
return this.search({
|
|
749
|
+
query: `SELECT shared_criterion.resource_name, shared_criterion.criterion_id, shared_criterion.type, shared_criterion.keyword.text, shared_criterion.keyword.match_type, shared_set.id, shared_set.name FROM shared_criterion WHERE shared_criterion.type = 'KEYWORD'${filter}`,
|
|
750
|
+
params: {
|
|
751
|
+
pageToken,
|
|
752
|
+
},
|
|
753
|
+
...args,
|
|
754
|
+
});
|
|
755
|
+
},
|
|
756
|
+
async mutateSharedCriteria(opts = {}) {
|
|
757
|
+
return this._makeRequest({
|
|
758
|
+
method: "POST",
|
|
759
|
+
path: "/v21/customers/{customerClientId}/sharedCriteria:mutate",
|
|
760
|
+
...opts,
|
|
761
|
+
});
|
|
762
|
+
},
|
|
763
|
+
async listCampaignSharedSets({
|
|
764
|
+
query, pageToken, ...args
|
|
765
|
+
}) {
|
|
766
|
+
const filter = query
|
|
767
|
+
? ` AND (campaign.name LIKE '%${sanitizeGaqlString(query)}%' OR shared_set.name LIKE '%${sanitizeGaqlString(query)}%')`
|
|
768
|
+
: "";
|
|
769
|
+
return this.search({
|
|
770
|
+
query: `SELECT campaign_shared_set.resource_name, campaign_shared_set.status, campaign.id, campaign.name, shared_set.id, shared_set.name FROM campaign_shared_set WHERE campaign_shared_set.status = 'ENABLED'${filter}`,
|
|
771
|
+
params: {
|
|
772
|
+
pageToken,
|
|
773
|
+
},
|
|
774
|
+
...args,
|
|
775
|
+
});
|
|
776
|
+
},
|
|
777
|
+
async mutateCampaignSharedSets(opts = {}) {
|
|
778
|
+
return this._makeRequest({
|
|
779
|
+
method: "POST",
|
|
780
|
+
path: "/v21/customers/{customerClientId}/campaignSharedSets:mutate",
|
|
781
|
+
...opts,
|
|
782
|
+
});
|
|
783
|
+
},
|
|
784
|
+
async listAllSharedCriteria({
|
|
785
|
+
query, pageToken, ...args
|
|
786
|
+
}) {
|
|
787
|
+
const filter = query
|
|
788
|
+
? ` WHERE shared_set.name LIKE '%${sanitizeGaqlString(query)}%'`
|
|
789
|
+
: "";
|
|
790
|
+
return this.search({
|
|
791
|
+
query: `SELECT shared_criterion.resource_name, shared_criterion.criterion_id, shared_criterion.type, shared_criterion.keyword.text, shared_criterion.keyword.match_type, shared_set.id, shared_set.name FROM shared_criterion${filter}`,
|
|
792
|
+
params: {
|
|
793
|
+
pageToken,
|
|
794
|
+
},
|
|
795
|
+
...args,
|
|
796
|
+
});
|
|
797
|
+
},
|
|
798
|
+
async listAllAdGroupCriteria({
|
|
799
|
+
query, pageToken, ...args
|
|
800
|
+
}) {
|
|
801
|
+
const filter = query
|
|
802
|
+
? ` WHERE ad_group.name LIKE '%${sanitizeGaqlString(query)}%'`
|
|
803
|
+
: "";
|
|
804
|
+
return this.search({
|
|
805
|
+
query: `SELECT ad_group_criterion.criterion_id, ad_group_criterion.resource_name, ad_group_criterion.type, ad_group_criterion.status, ad_group_criterion.negative, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.cpc_bid_micros, ad_group.id, ad_group.name FROM ad_group_criterion${filter}`,
|
|
806
|
+
params: {
|
|
807
|
+
pageToken,
|
|
808
|
+
},
|
|
809
|
+
...args,
|
|
810
|
+
});
|
|
811
|
+
},
|
|
812
|
+
async listAllCampaignBudgets({
|
|
813
|
+
query, pageToken, ...args
|
|
814
|
+
}) {
|
|
815
|
+
const filter = query
|
|
816
|
+
? ` AND campaign_budget.name LIKE '%${sanitizeGaqlString(query)}%'`
|
|
817
|
+
: "";
|
|
818
|
+
return this.search({
|
|
819
|
+
query: `SELECT campaign_budget.id, campaign_budget.name, campaign_budget.amount_micros, campaign_budget.delivery_method, campaign_budget.period, campaign_budget.status FROM campaign_budget WHERE campaign_budget.status = 'ENABLED'${filter}`,
|
|
820
|
+
params: {
|
|
821
|
+
pageToken,
|
|
822
|
+
},
|
|
823
|
+
...args,
|
|
824
|
+
});
|
|
825
|
+
},
|
|
826
|
+
async mutateCampaignBudgets(opts = {}) {
|
|
827
|
+
return this._makeRequest({
|
|
828
|
+
method: "POST",
|
|
829
|
+
path: "/v21/customers/{customerClientId}/campaignBudgets:mutate",
|
|
830
|
+
...opts,
|
|
831
|
+
});
|
|
832
|
+
},
|
|
833
|
+
async listCampaignCriteria({
|
|
834
|
+
query, pageToken, ...args
|
|
835
|
+
}) {
|
|
836
|
+
const filter = query
|
|
837
|
+
? ` AND campaign.name LIKE '%${sanitizeGaqlString(query)}%'`
|
|
838
|
+
: "";
|
|
839
|
+
return this.search({
|
|
840
|
+
query: `SELECT campaign_criterion.resource_name, campaign_criterion.criterion_id, campaign_criterion.type, campaign_criterion.status, campaign_criterion.negative, campaign_criterion.keyword.text, campaign_criterion.keyword.match_type, campaign.id, campaign.name FROM campaign_criterion WHERE campaign_criterion.type = 'KEYWORD'${filter}`,
|
|
841
|
+
params: {
|
|
842
|
+
pageToken,
|
|
843
|
+
},
|
|
844
|
+
...args,
|
|
845
|
+
});
|
|
846
|
+
},
|
|
847
|
+
async mutateCampaignCriteria(opts = {}) {
|
|
848
|
+
return this._makeRequest({
|
|
849
|
+
method: "POST",
|
|
850
|
+
path: "/v21/customers/{customerClientId}/campaignCriteria:mutate",
|
|
851
|
+
...opts,
|
|
852
|
+
});
|
|
853
|
+
},
|
|
854
|
+
async listAllCampaignCriteria({
|
|
855
|
+
query, pageToken, ...args
|
|
856
|
+
}) {
|
|
857
|
+
const filter = query
|
|
858
|
+
? ` WHERE campaign.name LIKE '%${sanitizeGaqlString(query)}%'`
|
|
859
|
+
: "";
|
|
860
|
+
return this.search({
|
|
861
|
+
query: `SELECT campaign_criterion.resource_name, campaign_criterion.criterion_id, campaign_criterion.type, campaign_criterion.status, campaign_criterion.negative, campaign_criterion.keyword.text, campaign_criterion.keyword.match_type, campaign.id, campaign.name FROM campaign_criterion${filter}`,
|
|
862
|
+
params: {
|
|
863
|
+
pageToken,
|
|
864
|
+
},
|
|
865
|
+
...args,
|
|
866
|
+
});
|
|
867
|
+
},
|
|
868
|
+
async listAllBiddingStrategies({
|
|
869
|
+
query, pageToken, ...args
|
|
870
|
+
}) {
|
|
871
|
+
const filter = query
|
|
872
|
+
? ` AND bidding_strategy.name LIKE '%${sanitizeGaqlString(query)}%'`
|
|
873
|
+
: "";
|
|
874
|
+
return this.search({
|
|
875
|
+
query: `SELECT bidding_strategy.id, bidding_strategy.name, bidding_strategy.type, bidding_strategy.status FROM bidding_strategy WHERE bidding_strategy.status = 'ENABLED'${filter}`,
|
|
876
|
+
params: {
|
|
877
|
+
pageToken,
|
|
878
|
+
},
|
|
879
|
+
...args,
|
|
880
|
+
});
|
|
881
|
+
},
|
|
882
|
+
async mutateBiddingStrategies(opts = {}) {
|
|
883
|
+
return this._makeRequest({
|
|
884
|
+
method: "POST",
|
|
885
|
+
path: "/v21/customers/{customerClientId}/biddingStrategies:mutate",
|
|
886
|
+
...opts,
|
|
887
|
+
});
|
|
888
|
+
},
|
|
889
|
+
async listKeywordQualityScores({
|
|
890
|
+
campaignId, adGroupId, dateRange, ...args
|
|
891
|
+
}) {
|
|
892
|
+
const conditions = [
|
|
893
|
+
`segments.date DURING ${dateRange ?? "LAST_30_DAYS"}`,
|
|
894
|
+
];
|
|
895
|
+
if (campaignId) conditions.push(`campaign.id = ${Number(campaignId)}`);
|
|
896
|
+
if (adGroupId) conditions.push(`ad_group.id = ${Number(adGroupId)}`);
|
|
897
|
+
return this.search({
|
|
898
|
+
query: `SELECT keyword_view.resource_name, ad_group_criterion.keyword.text, ad_group_criterion.keyword.match_type, ad_group_criterion.status, ad_group_criterion.quality_info.quality_score, ad_group_criterion.quality_info.creative_quality_score, ad_group_criterion.quality_info.post_click_quality_score, ad_group_criterion.quality_info.search_predicted_ctr, metrics.historical_quality_score, metrics.historical_creative_quality_score, metrics.historical_landing_page_quality_score, metrics.historical_search_predicted_ctr, ad_group.id, ad_group.name, campaign.id, campaign.name FROM keyword_view WHERE ${conditions.join(" AND ")}`,
|
|
899
|
+
...args,
|
|
900
|
+
});
|
|
901
|
+
},
|
|
314
902
|
},
|
|
315
903
|
};
|
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/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.9",
|
|
11
11
|
type: "source",
|
|
12
12
|
dedupe: "unique",
|
|
13
13
|
sampleEmit,
|
|
@@ -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/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.9",
|
|
12
12
|
type: "source",
|
|
13
13
|
dedupe: "unique",
|
|
14
14
|
sampleEmit,
|