Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions102

Overview

This node integrates with the Google Tag Manager (GTM) API, allowing users to manage various GTM resources programmatically within n8n workflows. Specifically, for the Account resource and the List Accounts operation, it retrieves a list of all GTM accounts accessible to the authenticated user.

Common scenarios where this node is beneficial include:

  • Automating the retrieval of GTM account information for reporting or auditing.
  • Integrating GTM account data into broader marketing or analytics workflows.
  • Synchronizing GTM account lists with other systems or databases.

Example use case:

  • A marketing team wants to automatically fetch all their GTM accounts daily and update a dashboard with the latest account details.

Properties

Name Meaning
Optional Query Parameters Additional parameters to customize the API request. Options include:
- Allow User Permission Feature Update (boolean): Allows updating user permission features.
- Built-In Variable Type (select from many predefined types).
- Container ID (string): ID of container to merge.
- Container Version ID (string): Specify published version.
- Copy Settings (boolean): Whether to copy tag settings.
- Copy Terms Of Service (boolean): Accept terms of service agreements.
- Copy Users (boolean): Whether to copy users.
- Destination ID (string): Linked destination ID.
- Fingerprint (string): Must match stored fingerprint.
- Include Google Tags (boolean): Include accounts associated with Google Tag.
- Page Token (string): Token for pagination.
- Setting Source (option): Source of config setting after combine.
- Tag ID (string): Tag ID for GTM Container.
- Tag Name (string): Name for new tag.
- Trigger ID (string): Triggers to move to folder.
- Variable ID (string): Variables to move to folder.

Note: For the List Accounts operation, the relevant optional query parameters would typically be those that affect listing behavior such as pageToken and includeGoogleTags.

Output

The output is a JSON array containing the response from the Google Tag Manager API for the requested operation.

For List Accounts, the JSON output will contain an array of GTM account objects accessible by the user. Each account object includes details such as account ID, name, and other metadata as provided by the GTM API.

No binary data output is involved in this operation.

Dependencies

  • Requires an OAuth2 API credential configured for Google Tag Manager API access.
  • The node uses the Google Tag Manager API base URL: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the Google account are necessary to list GTM accounts.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure that a valid Google Tag Manager OAuth2 credential is configured in n8n.
  • Required Parameter Errors: The node validates required parameters like Account ID for certain operations. For List Accounts, no account ID is required, but if you switch operations, ensure all required IDs are provided.
  • API Rate Limits: Google APIs have rate limits; hitting these may cause errors. Implement retries or backoff strategies if needed.
  • Invalid Query Parameters: Providing unsupported or incorrectly formatted optional query parameters may cause API errors.
  • Pagination Handling: When using pageToken for paginated results, ensure correct tokens are used to retrieve subsequent pages.

Links and References


This summary focuses on the Account resource and the List Accounts operation as requested, based on static analysis of the provided source code and property definitions.

Discussion