Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions84

Overview

This node interacts with the Google Tag Manager (GTM) API, specifically supporting operations related to Google Tag Configuration among many other GTM resources. For the Get Google Tag Configuration operation, it retrieves a specific Google Tag Configuration from a GTM workspace within a container and account.

This is useful when you want to programmatically fetch details about a particular Google Tag Configuration for auditing, reporting, or further automation workflows involving tag management.

Practical example:

  • Automatically retrieve the configuration of a Google Tag in a specific workspace to verify settings before publishing changes.
  • Use the retrieved configuration data to synchronize or compare tag setups across multiple containers or accounts.

Properties

Name Meaning
Account ID The GTM Account ID where the container and workspace reside.
Container ID The GTM Container ID that holds the workspace and Google Tag Configuration.
Workspace ID The GTM Workspace ID within the container where the Google Tag Configuration exists.
Google Tag Configuration ID The unique identifier of the Google Tag Configuration to retrieve.
Optional Query Parameters Additional optional parameters to customize the request (e.g., allowUserPermissionFeatureUpdate).

Output

The output is a JSON array containing the details of the requested Google Tag Configuration object as returned by the Google Tag Manager API. This includes all properties of the Google Tag Configuration such as its settings, metadata, and identifiers.

No binary data output is involved in this operation.

Dependencies

  • Requires an OAuth2 API credential configured for Google Tag Manager API access.
  • The node makes HTTP requests to the Google Tag Manager API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the Google Tag Manager account are necessary to read Google Tag Configurations.

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, Container ID, Workspace ID, and Google Tag Configuration ID. Missing any of these will cause an error. Double-check that these IDs are correctly provided.
  • API Errors: Errors from the Google API (e.g., permission denied, not found) will be surfaced with messages prefixed by "Error calling GTM API". Check the message and stack trace for details.
  • Unknown Operation: If an unsupported operation is selected, the node will throw an "Unknown operation" error.

Links and References

Discussion