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. Specifically, for the Container resource and the Delete Container operation, it enables users to delete a specified GTM container within an account.

Common scenarios where this node is beneficial include:

  • Automating cleanup of unused or obsolete GTM containers.
  • Managing GTM infrastructure as code by programmatically deleting containers during deployment pipelines.
  • Integrating GTM container management into broader workflows that require dynamic container lifecycle control.

Example use case:

  • A marketing team automates the removal of test containers after campaigns end by triggering this node with the appropriate Account ID and Container ID.

Properties

Name Meaning
Account ID The unique identifier of the Google Tag Manager Account containing the container to delete.
Container ID The unique identifier of the GTM Container to be deleted.
Optional Query Parameters Additional optional parameters for the API call. For Delete Container, these are generally not required but can include flags like allowUserPermissionFeatureUpdate if applicable.

Note: The node supports many other properties for different operations and resources, but for the Delete Container operation, only Account ID, Container ID, and optionally Optional Query Parameters are relevant.

Output

The output is a JSON array containing the response from the Google Tag Manager API after attempting to delete the container. Typically, a successful delete operation returns an empty response or confirmation object indicating the container was deleted.

The structure of the output JSON depends on the API's response but usually includes status information about the deletion.

No binary data is output by this operation.

Dependencies

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

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 that both Account ID and Container ID are provided. Missing either will cause an error.
  • Permission Denied: If the API returns permission errors, verify that the authenticated user has sufficient rights to delete containers in the specified account.
  • API Rate Limits: Frequent calls may hit Google API rate limits; handle such errors by implementing retries or backoff strategies.
  • Unknown Operation Error: This should not occur if the operation is correctly set to "Delete Container". If it does, verify the operation parameter.

Links and References


This summary focuses solely on the Container - Delete Container operation as requested, based on static analysis of the provided source code and property definitions.

Discussion