Skip to content

Commit

Permalink
Google Ads - update to api v18 (#15591)
Browse files Browse the repository at this point in the history
* update to api v18

* pnpm-lock.yaml

* update userListId prop
  • Loading branch information
michelle0927 authored Feb 21, 2025
1 parent 6e2214c commit 5300065
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "google_ads-add-contact-to-list-by-email",
name: "Add Contact to Customer List by Email",
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)",
version: "0.1.1",
version: "0.1.2",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/google_ads/actions/common/props.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const DEFAULT_DOCS =
"https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList";
"https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList";

export const getAdditionalFields = (docsLink = DEFAULT_DOCS) => ({
type: "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const USER_LIST_CRM_BASED_PROPS = {
type: "string",
label: "App ID",
description:
"A string that uniquely identifies a mobile application from which the data was collected. [See the documentation](https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList#CrmBasedUserListInfo) for more details.",
"A string that uniquely identifies a mobile application from which the data was collected. [See the documentation](https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList#CrmBasedUserListInfo) for more details.",
optional: true,
},
};
Expand All @@ -74,7 +74,7 @@ const USER_LIST_RULE_BASED_PROPS = {
type: "object",
label: "Flexible Rule Customer List",
description:
"Flexible rule representation of visitors with one or multiple actions. [See the documentation](https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList#FlexibleRuleUserListInfo) on how to build this object. Values will be parsed as JSON where applicable.",
"Flexible rule representation of visitors with one or multiple actions. [See the documentation](https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList#FlexibleRuleUserListInfo) on how to build this object. Values will be parsed as JSON where applicable.",
optional: true,
},
};
Expand All @@ -84,15 +84,15 @@ const USER_LIST_LOGICAL_PROPS = {
type: "string[]",
label: "Rules",
description:
"Logical list rules that define this customer list. [See the documentation](https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList#UserListLogicalRuleInfo) on how to build each object. Values will be parsed as JSON where applicable.",
"Logical list rules that define this customer list. [See the documentation](https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList#UserListLogicalRuleInfo) on how to build each object. Values will be parsed as JSON where applicable.",
},
};

const USER_LIST_BASIC_PROPS = {
conversionActions: {
type: "string[]",
label: "Conversion action(s)",
description: "One or more [conversion actions](https://developers.google.com/google-ads/api/rest/reference/rest/v16/ConversionAction) to build the list with.",
description: "One or more [conversion actions](https://developers.google.com/google-ads/api/rest/reference/rest/v18/ConversionAction) to build the list with.",
optional: true,
options: async() => {
const {
Expand All @@ -115,7 +115,7 @@ const USER_LIST_BASIC_PROPS = {
remarketingActions: {
type: "string[]",
label: "Remarketing action(s)",
description: "One or more [remarketing actions](https://developers.google.com/google-ads/api/rest/reference/rest/v16/RemarketingAction).",
description: "One or more [remarketing actions](https://developers.google.com/google-ads/api/rest/reference/rest/v18/RemarketingAction).",
optional: true,
options: async() => {
const {
Expand Down Expand Up @@ -198,37 +198,37 @@ export const USER_LIST_TYPE_OPTIONS = [
label: "CRM-based - a list of provided customers",
value: USER_LIST_TYPES.CRM_BASED,
docsLink:
"https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList#CrmBasedUserListInfo",
"https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList#CrmBasedUserListInfo",
props: USER_LIST_CRM_BASED_PROPS,
},
{
label: "Rule-Based - a customer list generated by a rule",
value: USER_LIST_TYPES.RULE_BASED,
docsLink:
"https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList#RuleBasedUserListInfo",
"https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList#RuleBasedUserListInfo",
props: USER_LIST_RULE_BASED_PROPS,
},
{
label: "Logical - a custom combination of customer lists",
value: USER_LIST_TYPES.LOGICAL,
docsLink:
"https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList#LogicalUserListInfo",
"https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList#LogicalUserListInfo",
props: USER_LIST_LOGICAL_PROPS,
},
{
label:
"Basic - a customer list targeting as a collection of conversions or remarketing actions",
value: USER_LIST_TYPES.BASIC,
docsLink:
"https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList#BasicUserListInfo",
"https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList#BasicUserListInfo",
props: USER_LIST_BASIC_PROPS,
},
{
label:
"Lookalike - a list composed of customers similar to those of a configurable seed",
value: USER_LIST_TYPES.LOOKALIKE,
docsLink:
"https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList#LookalikeUserListInfo",
"https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList#LookalikeUserListInfo",
props: USER_LIST_LOOKALIKE_PROPS,
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ export default {
...common,
key: "google_ads-create-customer-list",
name: "Create Customer List",
description:
"Create a new customer list in Google Ads. [See the documentation](https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList)",
version: "0.0.2",
description: "Create a new customer list in Google Ads. [See the documentation](https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList)",
version: "0.0.3",
type: "action",
props: {
...common.props,
Expand All @@ -34,8 +33,7 @@ export default {
listType: {
type: "string",
label: "List Type",
description:
"The [type of customer list](https://developers.google.com/google-ads/api/rest/reference/rest/v16/UserList#CrmBasedUserListInfo) to create.",
description: "The [type of customer list](https://developers.google.com/google-ads/api/rest/reference/rest/v18/UserList#CrmBasedUserListInfo) to create.",
options: USER_LIST_TYPE_OPTIONS.map(({
label, value,
}) => ({
Expand Down Expand Up @@ -95,6 +93,10 @@ export default {
additionalProps() {
const { listType } = this;

if (!listType) {
return {};
}

const option = USER_LIST_TYPE_OPTIONS.find(
({ value }) => value === listType,
);
Expand Down
10 changes: 5 additions & 5 deletions components/google_ads/actions/create-report/create-report.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default {
...common,
key: "google_ads-create-report",
name: "Create Report",
description: "Generates a report from your Google Ads data. [See the documentation](https://developers.google.com/google-ads/api/fields/v16/overview)",
version: "0.1.0",
description: "Generates a report from your Google Ads data. [See the documentation](https://developers.google.com/google-ads/api/fields/v18/overview)",
version: "0.1.1",
type: "action",
props: {
...common.props,
Expand All @@ -43,7 +43,7 @@ export default {
docsAlert: {
type: "alert",
alertType: "info",
content: `[See the documentation](https://developers.google.com/google-ads/api/fields/v16/${value}) for more information on available fields, segments and metrics.`,
content: `[See the documentation](https://developers.google.com/google-ads/api/fields/v18/${value}) for more information on available fields, segments and metrics.`,
},
objectFilter: {
type: "string[]",
Expand Down Expand Up @@ -106,7 +106,7 @@ export default {
segments: {
type: "string[]",
label: "Segments",
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)",
description: "Select any segments you want to include in your report. See the documentation [here](https://developers.google.com/google-ads/api/fields/v18/segments)",
options: resource.segments,
default: [
"segments.date",
Expand All @@ -117,7 +117,7 @@ export default {
metrics: {
type: "string[]",
label: "Metrics",
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)",
description: "Select any metrics you want to include in your report. See the documentation [here](https://developers.google.com/google-ads/api/fields/v18/metrics)",
options: resource.metrics,
optional: true,
reloadProps: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export default {
...common,
key: "google_ads-send-offline-conversion",
name: "Send Offline Conversion",
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)",
version: "0.0.2",
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/v18/ConversionAction)",
version: "0.0.3",
type: "action",
props: {
...common.props,
Expand All @@ -20,10 +20,10 @@ export default {
type: {
type: "string",
label: "Type",
description: "[The type](https://developers.google.com/google-ads/api/rest/reference/rest/v16/ConversionAction#ConversionActionType) of the conversion action.",
description: "[The type](https://developers.google.com/google-ads/api/rest/reference/rest/v18/ConversionAction#ConversionActionType) of the conversion action.",
options: CONVERSION_TYPE_OPTIONS,
},
additionalFields: getAdditionalFields("https://developers.google.com/google-ads/api/rest/reference/rest/v16/ConversionAction"),
additionalFields: getAdditionalFields("https://developers.google.com/google-ads/api/rest/reference/rest/v18/ConversionAction"),
},
async run({ $ }) {
const {
Expand Down
1 change: 1 addition & 0 deletions components/google_ads/common/queries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function listUserLists() {
const fields = [
"id",
"name",
"type",
].map((s) => `user_list.${s}`).join(", ");

return `SELECT ${fields} FROM user_list`;
Expand Down
23 changes: 11 additions & 12 deletions components/google_ads/google_ads.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
accountId,
customerClientId,
});
return response?.map(({
return response?.filter(({ userList: { type } }) => type === "CRM_BASED")?.map(({
userList: {
id, name,
},
Expand All @@ -34,7 +34,7 @@ export default {
accountId: {
type: "string",
label: "Use Google Ads As",
description: "Select an account from the list of [customers directly accessible by the authenticated user](https://developers.google.com/google-ads/api/rest/reference/rest/v16/customers/listAccessibleCustomers). This is usually a **Manager Account**, used as `login-customer-id`",
description: "Select an account from the list of [customers directly accessible by the authenticated user](https://developers.google.com/google-ads/api/rest/reference/rest/v18/customers/listAccessibleCustomers). This is usually a **Manager Account**, used as `login-customer-id`",
async options() {
const response = await this.listAccessibleCustomers();
return response?.map(((resourceName) => ({
Expand All @@ -46,7 +46,7 @@ export default {
customerClientId: {
type: "string",
label: "Managed Account",
description: "Select a [customer client](https://developers.google.com/google-ads/api/reference/rpc/v16/CustomerClient) from the list of [customers linked to the selected account](https://developers.google.com/google-ads/api/docs/account-management/get-account-hierarchy).",
description: "Select a [customer client](https://developers.google.com/google-ads/api/reference/rpc/v18/CustomerClient) from the list of [customers linked to the selected account](https://developers.google.com/google-ads/api/docs/account-management/get-account-hierarchy).",
useQuery: true,
optional: true,
async options({
Expand All @@ -71,7 +71,7 @@ export default {
leadFormId: {
type: "string",
label: "Lead Form ID",
description: "Select a [Lead Form](https://developers.google.com/google-ads/api/rest/reference/rest/v16/Asset#LeadFormAsset) to watch for new entries.",
description: "Select a [Lead Form](https://developers.google.com/google-ads/api/rest/reference/rest/v18/Asset#LeadFormAsset) to watch for new entries.",
async options({
accountId, customerClientId,
}) {
Expand Down Expand Up @@ -121,7 +121,7 @@ export default {
}) {
console.log("Executing query: ", query);
const response = await this._makeRequest({
path: "/v16/customers/{customerClientId}/googleAds:search",
path: "/v18/customers/{customerClientId}/googleAds:search",
method: "post",
data: {
query,
Expand All @@ -132,7 +132,7 @@ export default {
},
async listAccessibleCustomers() {
const response = await this._makeRequest({
path: "/v16/customers:listAccessibleCustomers",
path: "/v18/customers:listAccessibleCustomers",
});
return response.resourceNames;
},
Expand All @@ -151,7 +151,7 @@ export default {
},
async createUserList(args) {
const response = await this._makeRequest({
path: "v16/customers/{customerClientId}/userLists:mutate",
path: "v18/customers/{customerClientId}/userLists:mutate",
method: "post",
...args,
});
Expand Down Expand Up @@ -200,7 +200,6 @@ export default {
return this.search({
query: QUERIES.listResources(resource, query),
params: {
pageSize: 100,
pageToken,
},
...args,
Expand All @@ -217,7 +216,7 @@ export default {
},
async createConversionAction(args) {
const response = await this._makeRequest({
path: "v16/customers/{customerClientId}/conversionActions:mutate",
path: "v18/customers/{customerClientId}/conversionActions:mutate",
method: "post",
...args,
});
Expand All @@ -228,14 +227,14 @@ export default {
}) {
return this._makeRequest({
method: "POST",
path: `/v16/${path}:addOperations`,
path: `/v18/${path}:addOperations`,
...opts,
});
},
async createOfflineUserDataJob(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/v16/customers/{customerClientId}/offlineUserDataJobs:create",
path: "/v18/customers/{customerClientId}/offlineUserDataJobs:create",
...opts,
});
},
Expand All @@ -244,7 +243,7 @@ export default {
}) {
return this._makeRequest({
method: "POST",
path: `/v16/${path}:run`,
path: `/v18/${path}:run`,
...args,
});
},
Expand Down
4 changes: 2 additions & 2 deletions components/google_ads/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/google_ads",
"version": "0.3.0",
"version": "0.3.1",
"description": "Pipedream Google Ads Components",
"main": "google_ads.app.mjs",
"keywords": [
Expand All @@ -13,7 +13,7 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.6.5",
"@pipedream/platform": "^3.0.3",
"crypto": "^1.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@ export default {
...common,
key: "google_ads-new-campaign-created",
name: "New Campaign Created",
description: "Emit new event when a new campaign is created. [See the documentation](https://developers.google.com/google-ads/api/fields/v16/campaign)",
version: "0.0.2",
description: "Emit new event when a new campaign is created. [See the documentation](https://developers.google.com/google-ads/api/fields/v18/campaign)",
version: "0.0.3",
type: "source",
dedupe: "unique",
sampleEmit,
props: {
...common.props,
customerClientId: {
...common.props.customerClientId,
optional: false,
},
fields: {
type: "string[]",
label: "Extra Fields",
description: "Additional [campaign fields](https://developers.google.com/google-ads/api/fields/v16/campaign) to emit in the event",
description: "Additional [campaign fields](https://developers.google.com/google-ads/api/fields/v18/campaign) to emit in the event",
options: campaign.fields,
optional: true,
default: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export default {
...common,
key: "google_ads-new-lead-form-entry",
name: "New Lead Form Entry",
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)",
version: "0.0.2",
description: "Emit new event for new leads on a Lead Form. [See the documentation](https://developers.google.com/google-ads/api/fields/v18/lead_form_submission_data)",
version: "0.0.3",
type: "source",
dedupe: "unique",
sampleEmit,
Expand All @@ -29,7 +29,7 @@ export default {
docsAlert: {
type: "alert",
alertType: "info",
content: "If needed, see Google's documentation on [submission fields](https://developers.google.com/google-ads/api/reference/rpc/v16/LeadFormSubmissionField) and [custom submission fields](https://developers.google.com/google-ads/api/reference/rpc/v16/CustomLeadFormSubmissionField).",
content: "If needed, see Google's documentation on [submission fields](https://developers.google.com/google-ads/api/reference/rpc/v18/LeadFormSubmissionField) and [custom submission fields](https://developers.google.com/google-ads/api/reference/rpc/v18/CustomLeadFormSubmissionField).",
},
},
methods: {
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5300065

Please sign in to comment.