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, 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 versions are deleted after deployment or testing.
  • Integrating GTM version control into broader automation pipelines.

For example, a user might automate the deletion of old container versions after publishing a new one to keep the workspace clean and avoid clutter.

Properties

Name Meaning
Account ID The unique identifier of the GTM 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, these are generally not required but can include flags like allowUserPermissionFeatureUpdate.

Details on Optional Query Parameters

The optional query parameters collection includes many options, but for the "Delete Version" operation, the most relevant is:

  • Allow User Permission Feature Update: A boolean flag that must be set to true if the operation causes a change in user permissions features; otherwise, the operation will fail.

Other parameters listed in the full properties JSON are mostly related to other operations and resources and do not apply directly to deleting a version.

Output

The output of this operation is a JSON array containing the response from the GTM API after attempting to delete the specified container version.

  • If successful, the response typically confirms the deletion or returns an empty object.
  • If unsuccessful, an error is thrown (see Troubleshooting).

No binary data is output by this operation.

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 at https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account and container are necessary to perform deletion operations.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure that the Google Tag Manager OAuth2 API 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.
  • Permission Denied or Forbidden Errors: These occur if the authenticated user does not have sufficient permissions to delete the version. Verify user access rights in GTM.
  • Operation Failure Due to User Permission Feature Update: If the optional parameter allowUserPermissionFeatureUpdate is not set to true when required, the operation will fail. Set this flag accordingly.
  • 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 exclusively on the "Delete Version" operation of the "Version" resource as requested.

Discussion