n8n/packages/nodes-base/nodes/Google/Ads/CampaignDescription.ts

292 lines
7.2 KiB
TypeScript
Raw Normal View History

feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
import {
IDataObject,
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
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 Promise.resolve(
results.map((result) => {
return {
json: {
...result.campaign,
...result.metrics,
...result.campaignBudget,
},
};
}),
);
}
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
export const campaignOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['campaign'],
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
},
options: [
{
name: 'Get Many',
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
value: 'getAll',
description: 'Get many campaigns linked to the specified account',
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
routing: {
request: {
method: 'POST',
url: '={{"/v11/customers/" + $parameter["clientCustomerId"].toString().replace(/-/g, "") + "/googleAds:search"}}',
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
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 + "\'") + "' +
'" }}',
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
headers: {
'login-customer-id':
'={{$parameter["managerCustomerId"].toString().replace(/-/g, "")}}',
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
},
output: {
postReceive: [processCampaignSearchResponse],
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
},
action: 'Get many campaigns',
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
{
name: 'Get',
value: 'get',
description: 'Get a specific campaign',
routing: {
request: {
method: 'POST',
url: '={{"/v11/customers/" + $parameter["clientCustomerId"].toString().replace(/-/g, "") + "/googleAds:search"}}',
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
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, "")}}',
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
},
output: {
postReceive: [processCampaignSearchResponse],
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
},
2022-07-13 01:38:12 -07:00
action: 'Get a campaign',
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
],
default: 'getAll',
},
];
export const campaignFields: INodeProperties[] = [
{
displayName: 'Manager Customer ID',
name: 'managerCustomerId',
type: 'string',
required: true,
placeholder: '9998887777',
displayOptions: {
show: {
resource: ['campaign'],
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
},
default: '',
},
{
displayName: 'Client Customer ID',
name: 'clientCustomerId',
type: 'string',
required: true,
placeholder: '6665554444',
displayOptions: {
show: {
resource: ['campaign'],
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
},
default: '',
},
{
displayName: 'Campaign ID',
name: 'campaignId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: ['get'],
resource: ['campaign'],
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
},
default: '',
description: 'ID of the campaign',
},
{
displayName: 'Additional Options',
name: 'additionalOptions',
type: 'collection',
displayOptions: {
show: {
resource: ['campaign'],
operation: ['getAll'],
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
},
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',
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
},
{
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;
},
feat(Google Ads Node): Add new node (#3526) * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add basic layout with icon for Google Ads * Add node versioning(V1) * Add node and credential to package * Add api call to getall * Fix formdata in the body for the request * N8N-2928 Added custom queries to campaign * Fix header bug and add developer-token field * Add operation and fields to campaign new format * Add more configurations and queries * Add Invoice ressources and operations * Remov old version from the node * Fixed bud with typo * Correctly prepends the baseURL * add query to invocie request * Fixes header not parsing the expression * Invoice param changes * Fixes bug related to headers not being parsed, and bug with auth * Remove useless imports * Added analytics to google ad node and removed useless header * Removed url for testing * Fixed inconsistent behaviour with the access token not being refreshed * Added placeholders to help user * Removed useless comments * Resolved name confusion * Added support for body in a GET method * Removed hyphens, parse body's expression * Renamed operation for clarity * Remove unused code * Removed invoice resource and fixed bug with body and headers The invoice operation was removed since it does not reflect what a user would expect from it. Google ADS invoices are only used for big advertisers where invoicing is performed after the end of the month and for big sums. This would be misleading for the majority of the users expecting an expenses report. Also fixed a bug with header and body being sent since it was broken for multiple input rows. The first execution would override all others. Lastly, made some improvements to the node itself by transforming data, adding filters and operations. * Improve campagin operation and remove analytics; fix tests * Improve tooltips and descriptions * Fix lint issues * Improve tooltip to explain amounts in micros * Change wording for micros * Change the fix to a more elegant solution Co-authored-by: Cyril Gobrecht <cyril.gobrecht@gmail.com> Co-authored-by: Aël Gobrecht <ael.gobrecht@gmail.com>
2022-07-04 13:47:50 -07:00
];