Google Ads Advanced icon

Google Ads Advanced

使用 Google Ads API

广告系列 → 更新

AI-generated

Overview

This node integrates with the Google Ads API to manage advertising campaigns, ad groups, and ads. It supports operations such as retrieving, creating, updating, and deleting these entities. The node is useful for automating Google Ads management tasks within workflows, enabling marketers and advertisers to programmatically control their ad assets.

For the 广告系列 (Campaign) resource with the 更新 (Update) operation, the node updates an existing campaign's name and status based on provided inputs. This is beneficial when you want to modify campaign details dynamically, for example, pausing a campaign or renaming it without manual intervention in the Google Ads interface.

Practical Example

  • Automatically pause campaigns that have reached a budget limit.
  • Rename campaigns based on performance metrics calculated elsewhere in your workflow.
  • Update campaign statuses in bulk from external data sources.

Properties

Name Meaning
认证方式 Authentication method to use: OAuth2 (recommended) or Service Account
管理员客户ID Manager Customer ID (required): The Google Ads manager account ID
客户ID Client Customer ID (required): The specific client account ID under the manager
广告系列ID Campaign ID (required): The unique identifier of the campaign to update
广告系列名称 Campaign Name (required): The new name to assign to the campaign
状态 Status (required): The campaign's new status; options are 启用 (ENABLED), 暂停 (PAUSED), 移除 (REMOVED)

Output

The output is an array of JSON objects representing the result of the update operation. For the campaign update, the JSON contains the response from the Google Ads API mutation operation, typically including fields like resource names and confirmation of the updated campaign.

Example output structure:

{
  "mutate_operation_responses": [
    {
      "resourceName": "customers/{customerId}/campaigns/{campaignId}"
    }
  ]
}

If the operation fails and "Continue On Fail" is enabled, the output will include an error message object instead.

Dependencies

  • Requires Google Ads API access with either OAuth2 credentials or a service account.
  • Needs appropriate API credentials configured in n8n (an API key credential or OAuth2 token).
  • Uses the @htdangkhoa/google-ads library and google-auth-library for authentication and API calls.
  • Requires the Google Ads developer token and customer IDs to be set in credentials.

Troubleshooting

  • Authentication errors: Ensure that the OAuth2 token or service account credentials are valid and have the necessary scopes (https://www.googleapis.com/auth/adwords).
  • Invalid campaign ID: Verify that the campaign ID exists and belongs to the specified client customer.
  • Permission issues: The authenticated user must have permission to update campaigns in the target account.
  • API quota limits: Google Ads API enforces quotas; hitting these may cause errors.
  • Malformed input: Make sure all required properties (campaign ID, name, status) are provided and correctly formatted.

Common error messages:

  • "Request had invalid authentication credentials." — Check credentials and refresh tokens.
  • "Resource not found." — Confirm campaign ID and customer ID correctness.
  • "User does not have permission to access this customer." — Verify account permissions.

Links and References

Discussion