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, for the Variable resource and the Delete Variable operation, it enables deleting a GTM Variable within a specified workspace, container, and account.

This operation is useful when you want to automate the cleanup or management of GTM variables, such as removing outdated or unused variables from your GTM setup without manually accessing the GTM web interface.

Practical example:

  • Automatically delete a variable in GTM when it is no longer needed after a deployment or configuration change.
  • Clean up variables across multiple containers or workspaces in bulk using automation workflows.

Properties

Name Meaning
Account ID The Google Tag Manager Account ID where the variable exists.
Container ID The GTM Container ID that contains the variable.
Workspace ID The GTM Workspace ID within the container where the variable resides.
Variable ID The specific GTM Variable ID to be deleted.
Optional Query Parameters Additional optional parameters for the request; includes options like allowUserPermissionFeatureUpdate (boolean) and others mostly related to built-in variable types and advanced GTM features.

Output

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

  • The json output field will contain the parsed JSON response from the GTM API.
  • No binary data is involved in this operation.

Dependencies

  • Requires an active connection to the Google Tag Manager API via OAuth2 authentication.
  • The node expects valid credentials configured in n8n for Google Tag Manager API access.
  • Network connectivity to https://www.googleapis.com/tagmanager/v2 is required.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure that the Google Tag Manager API OAuth2 credentials are properly set up in n8n.
  • Required Parameter Missing: Errors indicating missing Account ID, Container ID, Workspace ID, or Variable ID mean these fields must be provided and correctly filled.
  • API Permission Issues: If the API call fails due to permission errors, verify that the authenticated user has sufficient permissions to delete variables in the specified GTM account/container/workspace.
  • Invalid Variable ID: If the variable ID does not exist or is incorrect, the API will return an error. Double-check the variable ID before running the operation.
  • Optional Query Parameters: Misuse or incorrect values in optional query parameters may cause the API to reject the request. Use defaults unless specific advanced behavior is needed.

Links and References


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

Discussion