Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions84

Overview

This node integrates with the Google Tag Manager (GTM) API, allowing users to manage various GTM resources programmatically. Specifically, the "Delete Version" operation under the "Version" resource enables users to delete a specific container version within their GTM account.

Common scenarios for this operation include:

  • Cleaning up outdated or unused container versions to maintain an organized GTM environment.
  • Automating version management workflows where certain versions need to be removed after deployment or testing.
  • Integrating GTM version control into broader automation pipelines.

For example, a user might automate the deletion of all container versions older than a certain date to keep their GTM workspace clean and efficient.

Properties

Name Meaning
Account ID The unique identifier of the Google Tag Manager Account where the container resides.
Container ID The unique identifier of the GTM Container that holds the version to be deleted.
Version ID The unique identifier of the GTM Container Version to delete.
Optional Query Parameters Additional optional parameters to customize the request. For this operation, typically empty.

Details on input properties relevant to "Delete Version":

  • Account ID: Required to specify which GTM account the container belongs to.
  • Container ID: Required to specify the container within the account.
  • Version ID: Required to identify the exact version to delete.
  • Optional Query Parameters: A collection of optional flags or settings; not specifically used in the delete version operation but available for extensibility.

Output

The output is a JSON array containing the response from the Google Tag Manager API after attempting to delete the specified container version.

  • Typically, the API returns an empty object {} or confirmation of deletion.
  • The json output field will contain this parsed response.
  • No binary data is involved in this operation.

Example output JSON:

[{}]

Dependencies

  • Requires valid Google Tag Manager API credentials configured in n8n, specifically an OAuth2 authentication token for the Google Tag Manager API.
  • The node uses the official GTM API endpoint: 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 the Google Tag Manager OAuth2 credentials are properly set up in n8n.
  • Required Parameter Errors: The node validates that Account ID, Container ID, and Version ID are provided. Missing any of these will cause an error indicating which parameter is required.
  • API Errors: Errors returned by the GTM API (e.g., insufficient permissions, non-existent version) will be surfaced with messages prefixed by "Error calling GTM API". Check the GTM account permissions and verify the IDs used.
  • Unknown Operation Error: This should not occur if the node is used correctly, but indicates an invalid operation name was selected.

Links and References


This summary focuses on the "Delete Version" operation of the "Version" resource as requested, based on static analysis of the node's source code and provided property definitions.

Discussion