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, specifically allowing management of GTM Built-In Variables among many other GTM resources. The "Revert Built-In Variable" operation enables users to revert changes made to a built-in variable within a specific GTM workspace. This is useful when you want to discard modifications and restore the built-in variable to its previous state.

Common scenarios include:

  • Undoing accidental or unwanted changes to built-in variables in a GTM workspace.
  • Managing GTM configurations programmatically as part of CI/CD pipelines or automated workflows.
  • Maintaining consistency across GTM environments by reverting variables to known good states.

Example: If a user modifies a built-in variable but later decides to discard those changes, this operation can be used to revert that variable back to its original configuration within the specified workspace.

Properties

Name Meaning
Account ID The Google Tag Manager Account ID where the built-in variable exists.
Container ID The GTM Container ID containing the workspace and built-in variable.
Workspace ID The GTM Workspace ID where the built-in variable changes are to be reverted.
Optional Query Parameters Additional optional parameters for the API call:
- Allow User Permission Feature Update Boolean flag to allow user permission feature updates if applicable.
- Built-In Variable Type The type of built-in variable to revert (e.g., Advertiser ID, Click Classes, Page URL, etc.).

Note: The "Built-In Variable Type" option provides a comprehensive list of possible built-in variable types supported by GTM, such as advertiserId, clickClasses, pageUrl, eventName, and many others.

Output

The output is a JSON array containing the response from the Google Tag Manager API after performing the revert operation. The structure corresponds to the reverted built-in variable resource as returned by the GTM API, typically including fields like:

  • name: The name of the built-in variable.
  • type: The type of the built-in variable.
  • Other metadata related to the built-in variable's configuration and status.

No binary data is output by this node.

Dependencies

  • Requires an active Google Tag Manager API OAuth2 credential configured in n8n.
  • The node uses the Google Tag Manager API base URL: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account, container, and workspace are necessary to perform revert 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 must be provided for the operation to succeed.
  • Permission Denied: If the API returns permission errors, verify that the authenticated user has sufficient access rights to the GTM account and workspace.
  • Unknown Operation: If an unsupported operation is selected, the node will throw an error. Ensure the correct operation ("Revert Built-In Variable") is chosen.
  • API Rate Limits: Frequent calls may hit Google API rate limits; consider adding delays or retries in your workflow.

Links and References


This summary focuses on the "Revert Built-In Variable" operation within the Google Tag Manager node, describing its purpose, required inputs, outputs, dependencies, and common troubleshooting tips.

Discussion