first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,287 @@
import type {
IDataObject,
IExecuteSingleFunctions,
IN8nHttpFullResponse,
INodeExecutionData,
INodeProperties,
} from 'n8n-workflow';
async function processCampaignSearchResponse(
this: IExecuteSingleFunctions,
_inputData: INodeExecutionData[],
responseData: IN8nHttpFullResponse,
): Promise<INodeExecutionData[]> {
const results = ((responseData.body as IDataObject).results as GoogleAdsCampaignElement) ?? [];
return results.map((result) => ({
json: {
...result.campaign,
...result.metrics,
...result.campaignBudget,
},
}));
}
export const campaignOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['campaign'],
},
},
options: [
{
name: 'Get Many',
value: 'getAll',
description: 'Get many campaigns linked to the specified account',
routing: {
request: {
method: 'POST',
url: '={{"/v20/customers/" + $parameter["clientCustomerId"].toString().replace(/-/g, "") + "/googleAds:search"}}',
body: {
query:
'={{ "' +
'select ' +
'campaign.id, ' +
'campaign.name, ' +
'campaign_budget.amount_micros, ' +
'campaign_budget.period,' +
'campaign.status,' +
'campaign.optimization_score,' +
'campaign.advertising_channel_type,' +
'campaign.advertising_channel_sub_type,' +
'metrics.impressions,' +
'metrics.interactions,' +
'metrics.interaction_rate,' +
'metrics.average_cost,' +
'metrics.cost_micros,' +
'metrics.conversions,' +
'metrics.cost_per_conversion,' +
'metrics.conversions_from_interactions_rate,' +
'metrics.video_views,' +
'metrics.average_cpm,' +
'metrics.ctr ' +
'from campaign ' +
'where campaign.id > 0 ' + // create a dummy where clause so we can append more conditions
'" + (["allTime", undefined, ""].includes($parameter.additionalOptions?.dateRange) ? "" : " and segments.date DURING " + $parameter.additionalOptions.dateRange) + " ' +
'" + (["all", undefined, ""].includes($parameter.additionalOptions?.campaignStatus) ? "" : " and campaign.status = \'" + $parameter.additionalOptions.campaignStatus + "\'") + "' +
'" }}',
},
headers: {
'login-customer-id':
'={{$parameter["managerCustomerId"].toString().replace(/-/g, "")}}',
},
},
output: {
postReceive: [processCampaignSearchResponse],
},
},
action: 'Get many campaigns',
},
{
name: 'Get',
value: 'get',
description: 'Get a specific campaign',
routing: {
request: {
method: 'POST',
url: '={{"/v20/customers/" + $parameter["clientCustomerId"].toString().replace(/-/g, "") + "/googleAds:search"}}',
returnFullResponse: true,
body: {
query:
'={{ "' +
'select ' +
'campaign.id, ' +
'campaign.name, ' +
'campaign_budget.amount_micros, ' +
'campaign_budget.period,' +
'campaign.status,' +
'campaign.optimization_score,' +
'campaign.advertising_channel_type,' +
'campaign.advertising_channel_sub_type,' +
'metrics.impressions,' +
'metrics.interactions,' +
'metrics.interaction_rate,' +
'metrics.average_cost,' +
'metrics.cost_micros,' +
'metrics.conversions,' +
'metrics.cost_per_conversion,' +
'metrics.conversions_from_interactions_rate,' +
'metrics.video_views,' +
'metrics.average_cpm,' +
'metrics.ctr ' +
'from campaign ' +
'where campaign.id = " + $parameter["campaignId"].toString().replace(/-/g, "")' +
'}}',
},
headers: {
'login-customer-id':
'={{$parameter["managerCustomerId"].toString().replace(/-/g, "")}}',
},
},
output: {
postReceive: [processCampaignSearchResponse],
},
},
action: 'Get a campaign',
},
],
default: 'getAll',
},
];
export const campaignFields: INodeProperties[] = [
{
displayName: 'Manager Customer ID',
name: 'managerCustomerId',
type: 'string',
required: true,
placeholder: '9998887777',
displayOptions: {
show: {
resource: ['campaign'],
},
},
default: '',
},
{
displayName: 'Client Customer ID',
name: 'clientCustomerId',
type: 'string',
required: true,
placeholder: '6665554444',
displayOptions: {
show: {
resource: ['campaign'],
},
},
default: '',
},
{
displayName: 'Campaign ID',
name: 'campaignId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: ['get'],
resource: ['campaign'],
},
},
default: '',
description: 'ID of the campaign',
},
{
displayName: 'Additional Options',
name: 'additionalOptions',
type: 'collection',
displayOptions: {
show: {
resource: ['campaign'],
operation: ['getAll'],
},
},
default: {},
description: 'Additional options for fetching campaigns',
placeholder: 'Add option',
options: [
{
displayName: 'Date Range',
name: 'dateRange',
description: 'Filters statistics by period',
type: 'options',
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
options: [
{
name: 'All Time',
value: 'allTime',
description: 'Fetch statistics for all period',
},
{
name: 'Today',
value: 'TODAY',
description: 'Today only',
},
{
name: 'Yesterday',
value: 'YESTERDAY',
description: 'Yesterday only',
},
{
name: 'Last 7 Days',
value: 'LAST_7_DAYS',
description: 'Last 7 days, not including today',
},
{
name: 'Last Business Week',
value: 'LAST_BUSINESS_WEEK',
description:
'The 5 day business week, Monday through Friday, of the previous business week',
},
{
name: 'This Month',
value: 'THIS_MONTH',
description: 'All days in the current month',
},
{
name: 'Last Month',
value: 'LAST_MONTH',
description: 'All days in the previous month',
},
{
name: 'Last 14 Days',
value: 'LAST_14_DAYS',
description: 'The last 14 days not including today',
},
{
name: 'Last 30 Days',
value: 'LAST_30_DAYS',
description: 'The last 30 days not including today',
},
],
default: 'allTime',
},
{
displayName: 'Show Campaigns by Status',
name: 'campaignStatus',
description: 'Filters campaigns by status',
type: 'options',
options: [
{
name: 'All',
value: 'all',
description: 'Fetch all campaigns regardless of status',
},
{
name: 'Enabled',
value: 'ENABLED',
description: 'Filter only active campaigns',
},
{
name: 'Paused',
value: 'PAUSED',
description: 'Filter only paused campaigns',
},
{
name: 'Removed',
value: 'REMOVED',
description: 'Filter only removed campaigns',
},
],
default: 'all',
},
],
},
];
type GoogleAdsCampaignElement = [
{
campaign: object;
metrics: object;
campaignBudget: object;
},
];
@@ -0,0 +1,25 @@
{
"node": "n8n-nodes-base.googleAds",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Analytics"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/google/oauth-single-service/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.googleads/"
}
],
"generic": [
{
"label": "15 Google apps you can combine and automate to increase productivity",
"icon": "💡",
"url": "https://n8n.io/blog/automate-google-apps-for-productivity/"
}
]
}
}
@@ -0,0 +1,73 @@
import { NodeConnectionTypes, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
import { campaignFields, campaignOperations } from './CampaignDescription';
export class GoogleAds implements INodeType {
description: INodeTypeDescription = {
displayName: 'Google Ads',
name: 'googleAds',
icon: 'file:googleAds.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Use the Google Ads API',
schemaPath: 'Google/Ads',
defaults: {
name: 'Google Ads',
},
usableAsTool: true,
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'googleAdsOAuth2Api',
required: true,
testedBy: {
request: {
method: 'GET',
url: '/v20/customers:listAccessibleCustomers',
},
},
},
],
requestDefaults: {
returnFullResponse: true,
baseURL: 'https://googleads.googleapis.com',
headers: {
'developer-token': '={{$credentials.developerToken}}',
},
},
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Campaign',
value: 'campaign',
},
],
default: 'campaign',
},
//-------------------------------
// Campaign Operations
//-------------------------------
...campaignOperations,
{
displayName:
'Divide field names expressed with <i>micros</i> by 1,000,000 to get the actual value',
name: 'campaigsNotice',
type: 'notice',
default: '',
displayOptions: {
show: {
resource: ['campaign'],
},
},
},
...campaignFields,
],
};
}
@@ -0,0 +1,51 @@
{
"type": "object",
"properties": {
"advertisingChannelType": {
"type": "string"
},
"amountMicros": {
"type": "string"
},
"averageCost": {
"type": "number"
},
"averageCpm": {
"type": "number"
},
"costMicros": {
"type": "string"
},
"ctr": {
"type": "number"
},
"id": {
"type": "string"
},
"impressions": {
"type": "string"
},
"interactionRate": {
"type": "number"
},
"interactions": {
"type": "string"
},
"name": {
"type": "string"
},
"period": {
"type": "string"
},
"resourceName": {
"type": "string"
},
"status": {
"type": "string"
},
"videoViews": {
"type": "string"
}
},
"version": 1
}
@@ -0,0 +1,48 @@
{
"type": "object",
"properties": {
"advertisingChannelType": {
"type": "string"
},
"amountMicros": {
"type": "string"
},
"averageCpm": {
"type": "number"
},
"costMicros": {
"type": "string"
},
"ctr": {
"type": "number"
},
"id": {
"type": "string"
},
"impressions": {
"type": "string"
},
"interactionRate": {
"type": "number"
},
"interactions": {
"type": "string"
},
"name": {
"type": "string"
},
"period": {
"type": "string"
},
"resourceName": {
"type": "string"
},
"status": {
"type": "string"
},
"videoViews": {
"type": "string"
}
},
"version": 6
}
@@ -0,0 +1,161 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
import getResult from './fixtures/get.json';
import getManyResult from './fixtures/getMany.json';
describe('Google Ads Node', () => {
const credentials = {
googleAdsOAuth2Api: {
oauthTokenData: {
access_token: 'access-token',
},
developerToken: 'test-developer-token',
},
};
describe('get', () => {
const googleAdsNock = nock('https://googleads.googleapis.com');
beforeAll(() => {
googleAdsNock
.post('/v20/customers/4445556666/googleAds:search', {
query:
'select ' +
'campaign.id, ' +
'campaign.name, ' +
'campaign_budget.amount_micros, ' +
'campaign_budget.period,' +
'campaign.status,' +
'campaign.optimization_score,' +
'campaign.advertising_channel_type,' +
'campaign.advertising_channel_sub_type,' +
'metrics.impressions,' +
'metrics.interactions,' +
'metrics.interaction_rate,' +
'metrics.average_cost,' +
'metrics.cost_micros,' +
'metrics.conversions,' +
'metrics.cost_per_conversion,' +
'metrics.conversions_from_interactions_rate,' +
'metrics.video_views,' +
'metrics.average_cpm,' +
'metrics.ctr ' +
'from campaign ' +
'where campaign.id = 12345678901',
})
.matchHeader('login-customer-id', '1112223333')
.reply(200, getResult);
});
afterAll(() => googleAdsNock.done());
new NodeTestHarness().setupTests({
credentials,
workflowFiles: ['get.workflow.json'],
});
});
describe('getMany', () => {
const googleAdsNock = nock('https://googleads.googleapis.com');
beforeAll(() => {
googleAdsNock
.post('/v20/customers/4445556666/googleAds:search', {
query:
'select ' +
'campaign.id, ' +
'campaign.name, ' +
'campaign_budget.amount_micros, ' +
'campaign_budget.period,' +
'campaign.status,' +
'campaign.optimization_score,' +
'campaign.advertising_channel_type,' +
'campaign.advertising_channel_sub_type,' +
'metrics.impressions,' +
'metrics.interactions,' +
'metrics.interaction_rate,' +
'metrics.average_cost,' +
'metrics.cost_micros,' +
'metrics.conversions,' +
'metrics.cost_per_conversion,' +
'metrics.conversions_from_interactions_rate,' +
'metrics.video_views,' +
'metrics.average_cpm,' +
'metrics.ctr ' +
'from campaign ' +
'where campaign.id > 0 ',
})
.matchHeader('login-customer-id', '1112223333')
.reply(200, getManyResult);
googleAdsNock
.post('/v20/customers/4445556666/googleAds:search', {
query:
'select ' +
'campaign.id, ' +
'campaign.name, ' +
'campaign_budget.amount_micros, ' +
'campaign_budget.period,' +
'campaign.status,' +
'campaign.optimization_score,' +
'campaign.advertising_channel_type,' +
'campaign.advertising_channel_sub_type,' +
'metrics.impressions,' +
'metrics.interactions,' +
'metrics.interaction_rate,' +
'metrics.average_cost,' +
'metrics.cost_micros,' +
'metrics.conversions,' +
'metrics.cost_per_conversion,' +
'metrics.conversions_from_interactions_rate,' +
'metrics.video_views,' +
'metrics.average_cpm,' +
'metrics.ctr ' +
'from campaign ' +
'where campaign.id > 0 ' +
' and segments.date DURING LAST_7_DAYS ' +
" and campaign.status = 'ENABLED'",
})
.matchHeader('login-customer-id', '1112223333')
.reply(200, getManyResult);
googleAdsNock
.post('/v20/customers/4445556666/googleAds:search', {
query:
'select ' +
'campaign.id, ' +
'campaign.name, ' +
'campaign_budget.amount_micros, ' +
'campaign_budget.period,' +
'campaign.status,' +
'campaign.optimization_score,' +
'campaign.advertising_channel_type,' +
'campaign.advertising_channel_sub_type,' +
'metrics.impressions,' +
'metrics.interactions,' +
'metrics.interaction_rate,' +
'metrics.average_cost,' +
'metrics.cost_micros,' +
'metrics.conversions,' +
'metrics.cost_per_conversion,' +
'metrics.conversions_from_interactions_rate,' +
'metrics.video_views,' +
'metrics.average_cpm,' +
'metrics.ctr ' +
'from campaign ' +
'where campaign.id > 0 ' +
" and campaign.status = 'REMOVED'",
})
.matchHeader('login-customer-id', '1112223333')
.reply(200, { ...getManyResult, results: undefined });
});
afterAll(() => googleAdsNock.done());
new NodeTestHarness().setupTests({
credentials,
workflowFiles: ['getMany.workflow.json'],
});
});
});
@@ -0,0 +1,27 @@
{
"results": [
{
"campaign": {
"resourceName": "customers/5171368254/campaigns/22682295812",
"status": "ENABLED",
"advertisingChannelType": "SEARCH",
"name": "Search-1",
"id": "22682295812"
},
"metrics": {
"videoViews": "0",
"conversions": 0,
"costMicros": "0",
"impressions": "0",
"interactions": "0"
},
"campaignBudget": {
"resourceName": "customers/5171368254/campaignBudgets/14669466664",
"period": "DAILY",
"amountMicros": "10000000"
}
}
],
"fieldMask": "campaign.id,campaign.name,campaignBudget.amountMicros,campaignBudget.period,campaign.status,campaign.optimizationScore,campaign.advertisingChannelType,campaign.advertisingChannelSubType,metrics.impressions,metrics.interactions,metrics.interactionRate,metrics.averageCost,metrics.costMicros,metrics.conversions,metrics.costPerConversion,metrics.conversionsFromInteractionsRate,metrics.videoViews,metrics.averageCpm,metrics.ctr",
"queryResourceConsumption": "596"
}
@@ -0,0 +1,27 @@
{
"results": [
{
"campaign": {
"resourceName": "customers/5171368254/campaigns/22682295812",
"status": "ENABLED",
"advertisingChannelType": "SEARCH",
"name": "Search-1",
"id": "22682295812"
},
"metrics": {
"videoViews": "0",
"conversions": 0,
"costMicros": "0",
"impressions": "0",
"interactions": "0"
},
"campaignBudget": {
"resourceName": "customers/5171368254/campaignBudgets/14669466664",
"period": "DAILY",
"amountMicros": "10000000"
}
}
],
"fieldMask": "campaign.id,campaign.name,campaignBudget.amountMicros,campaignBudget.period,campaign.status,campaign.optimizationScore,campaign.advertisingChannelType,campaign.advertisingChannelSubType,metrics.impressions,metrics.interactions,metrics.interactionRate,metrics.averageCost,metrics.costMicros,metrics.conversions,metrics.costPerConversion,metrics.conversionsFromInteractionsRate,metrics.videoViews,metrics.averageCpm,metrics.ctr",
"queryResourceConsumption": "570"
}
@@ -0,0 +1,77 @@
{
"name": "Google Ads Get",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [0, -160],
"id": "efd3f04e-8695-4f2c-8f8d-0b0166390d3f",
"name": "When clicking Execute workflow"
},
{
"parameters": {
"operation": "get",
"managerCustomerId": "111-222-3333",
"clientCustomerId": "444-555-6666",
"campaignId": "12345678901",
"requestOptions": {}
},
"type": "n8n-nodes-base.googleAds",
"typeVersion": 1,
"position": [220, -160],
"id": "773cca04-b4be-4bfd-8fb4-e37154df2991",
"name": "Get",
"credentials": {
"googleAdsOAuth2Api": {
"id": "VFEJAm9y8GDEsnS4",
"name": "Google Ads account"
}
}
}
],
"pinData": {
"Get": [
{
"json": {
"resourceName": "customers/5171368254/campaignBudgets/14669466664",
"status": "ENABLED",
"advertisingChannelType": "SEARCH",
"name": "Search-1",
"id": "22682295812",
"videoViews": "0",
"conversions": 0,
"costMicros": "0",
"impressions": "0",
"interactions": "0",
"period": "DAILY",
"amountMicros": "10000000"
}
}
]
},
"connections": {
"When clicking Execute workflow": {
"main": [
[
{
"node": "Get",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "b72b855a-9f8a-4872-9311-6e65940e85f1",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "e115be144a6a5547dbfca93e774dfffa178aa94a181854c13e2ce5e14d195b2e"
},
"id": "Ffm7CA1AIhKGiOlK",
"tags": []
}
@@ -0,0 +1,148 @@
{
"name": "Google Ads Get Many",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [0, 40],
"id": "efd3f04e-8695-4f2c-8f8d-0b0166390d3f",
"name": "When clicking Execute workflow"
},
{
"parameters": {
"managerCustomerId": "111-222-3333",
"clientCustomerId": "444-555-6666",
"additionalOptions": {},
"requestOptions": {}
},
"type": "n8n-nodes-base.googleAds",
"typeVersion": 1,
"position": [220, -160],
"id": "773cca04-b4be-4bfd-8fb4-e37154df2991",
"name": "Get Many",
"credentials": {
"googleAdsOAuth2Api": {
"id": "VFEJAm9y8GDEsnS4",
"name": "Google Ads account"
}
}
},
{
"parameters": {
"managerCustomerId": "111-222-3333",
"clientCustomerId": "444-555-6666",
"additionalOptions": {
"dateRange": "LAST_7_DAYS",
"campaignStatus": "ENABLED"
},
"requestOptions": {}
},
"type": "n8n-nodes-base.googleAds",
"typeVersion": 1,
"position": [220, 40],
"id": "3e913683-85bf-4295-98cd-2c8324d97094",
"name": "With Options",
"credentials": {
"googleAdsOAuth2Api": {
"id": "VFEJAm9y8GDEsnS4",
"name": "Google Ads account"
}
}
},
{
"parameters": {
"managerCustomerId": "111-222-3333",
"clientCustomerId": "444-555-6666",
"additionalOptions": {
"campaignStatus": "REMOVED"
},
"requestOptions": {}
},
"type": "n8n-nodes-base.googleAds",
"typeVersion": 1,
"position": [220, 240],
"id": "7043d66a-a68c-495b-b6db-ffc8f1551065",
"name": "No Results",
"credentials": {
"googleAdsOAuth2Api": {
"id": "VFEJAm9y8GDEsnS4",
"name": "Google Ads account"
}
}
}
],
"pinData": {
"Get Many": [
{
"json": {
"resourceName": "customers/5171368254/campaignBudgets/14669466664",
"status": "ENABLED",
"advertisingChannelType": "SEARCH",
"name": "Search-1",
"id": "22682295812",
"videoViews": "0",
"conversions": 0,
"costMicros": "0",
"impressions": "0",
"interactions": "0",
"period": "DAILY",
"amountMicros": "10000000"
}
}
],
"With Options": [
{
"json": {
"resourceName": "customers/5171368254/campaignBudgets/14669466664",
"status": "ENABLED",
"advertisingChannelType": "SEARCH",
"name": "Search-1",
"id": "22682295812",
"videoViews": "0",
"conversions": 0,
"costMicros": "0",
"impressions": "0",
"interactions": "0",
"period": "DAILY",
"amountMicros": "10000000"
}
}
],
"No Results": []
},
"connections": {
"When clicking Execute workflow": {
"main": [
[
{
"node": "Get Many",
"type": "main",
"index": 0
},
{
"node": "With Options",
"type": "main",
"index": 0
},
{
"node": "No Results",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "a77e4f29-8caa-4d3b-a7f9-9232c1234b93",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "e115be144a6a5547dbfca93e774dfffa178aa94a181854c13e2ce5e14d195b2e"
},
"id": "Ffm7CA1AIhKGiOlK",
"tags": []
}
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="230" preserveAspectRatio="xMidYMid"><path fill="#FBBC04" d="M5.888 166.405 90.88 20.9c10.796 6.356 65.236 36.484 74.028 42.214L79.916 208.627c-9.295 12.28-85.804-23.587-74.028-42.23z"/><path fill="#4285F4" d="M250.084 166.402 165.092 20.906C153.21 1.132 127.62-6.054 106.601 5.625S79.182 42.462 91.064 63.119l84.992 145.514c11.882 19.765 37.473 26.95 58.492 15.272 20.1-11.68 27.418-37.73 15.536-57.486z"/><ellipse cx="42.664" cy="187.924" fill="#34A853" rx="42.664" ry="41.604"/></svg>

After

Width:  |  Height:  |  Size: 546 B