Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions84

Overview

The "Update Container" operation in this Google Tag Manager (GTM) node allows users to update an existing GTM container within a specified account. This operation is useful for modifying container settings, configurations, or metadata programmatically via the GTM API.

Typical scenarios where this node is beneficial include:

  • Automating updates to GTM containers as part of deployment pipelines.
  • Integrating GTM container management into broader marketing or analytics workflows.
  • Synchronizing container changes across multiple environments or accounts.

For example, a user might update container details such as container name, usage context, or other configuration parameters by providing the updated data in the request body.

Properties

Name Meaning
Account ID The unique identifier of the GTM Account that owns the container to be updated.
Container ID The unique identifier of the GTM Container to update.
Optional Query Parameters Additional optional parameters to customize the update request.
Request Body JSON object containing the updated container data and properties to apply during the update.

Details on Properties:

  • Account ID: Required to specify which GTM account contains the container.
  • Container ID: Required to identify the specific container to update.
  • Optional Query Parameters: A collection of optional flags or parameters that can modify the behavior of the update operation (e.g., feature toggles).
  • Request Body: The main payload with the container's new configuration in JSON format.

Output

The output of this operation is a JSON object representing the updated GTM container resource as returned by the Google Tag Manager API. It includes all container properties after the update has been applied.

The structure typically contains fields such as:

  • Container metadata (name, path, accountId, containerId)
  • Configuration details
  • Usage context and permissions
  • Other container-specific attributes

No binary data is involved in this operation.

Dependencies

  • Requires valid Google Tag Manager API credentials configured in n8n (an OAuth2 API credential).
  • The node makes authenticated HTTP requests to the Google Tag Manager API endpoint https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account and container are necessary to perform update operations.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure that a valid Google Tag Manager API OAuth2 credential is configured and selected.
  • Required Parameter Errors: Errors indicating missing Account ID or Container ID mean these must be provided for the update to proceed.
  • API Errors: Errors from the GTM API may occur if the request body is malformed or if the user lacks permission. Review the error message for details.
  • Fingerprint Mismatch: If using the fingerprint parameter, ensure it matches the current container fingerprint to avoid conflicts.
  • Invalid JSON in Request Body: Ensure the JSON provided in the request body is valid and conforms to the expected schema of a GTM container resource.

Links and References

Discussion