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 within n8n workflows. Specifically, the "Delete Built-In Variable" operation under the "Built-In Variable" resource enables users to delete a built-in variable from a specified GTM workspace.

Common scenarios for this node include automating GTM container management tasks such as creating, updating, listing, or deleting built-in variables, tags, triggers, and other GTM entities. For example, a marketing team might automate the cleanup of unused built-in variables across multiple GTM containers to maintain an organized tagging environment.

Practical example:

  • Automatically delete a specific built-in variable from a GTM workspace when it is no longer needed, triggered by an external event or schedule.

Properties

Name Meaning
Account ID The unique identifier of the Google Tag Manager account where the built-in variable exists.
Container ID The identifier of the GTM container that holds the workspace containing the built-in variable.
Workspace ID The identifier of the GTM workspace within the container where the built-in variable is located.
Optional Query Parameters Additional optional parameters for the API request. Includes:
- Allow User Permission Feature Update (boolean): Allows user permissions feature update if true.
- Built-In Variable Type (select from many predefined types like Advertiser ID, Click Text, Page URL, etc.)
- Other parameters related to GTM entities (mostly not relevant for delete operation).

Note: For the "Delete Built-In Variable" operation, the key required properties are Account ID, Container ID, and Workspace ID. The specific built-in variable to delete is identified via the type parameter inside the optional query parameters.

Output

The node outputs a JSON array containing the response from the Google Tag Manager API after performing the delete operation. The structure corresponds to the API's response for deleting a built-in variable, which typically includes metadata about the deleted variable or confirmation of deletion.

No binary data output is involved in this operation.

Dependencies

  • Requires a valid Google Tag Manager API OAuth2 credential configured in n8n.
  • The node uses the Google Tag Manager API v2 endpoint (https://www.googleapis.com/tagmanager/v2).
  • Proper permissions on the GTM account and container 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 set up and connected.
  • Required Parameter Missing: Errors indicating missing Account ID, Container ID, or Workspace ID mean these fields must be provided and correctly filled.
  • Permission Denied: If the API returns permission errors, verify that the authenticated user has sufficient rights to delete built-in variables in the specified GTM workspace.
  • Invalid Built-In Variable Type: Ensure the type parameter in optional query parameters matches one of the supported built-in variable types; otherwise, the API may reject the request.
  • API Rate Limits: Frequent calls may hit Google API rate limits; implement retries or backoff strategies if needed.

Links and References


If you need details on other operations or resources, feel free to ask!

Discussion