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 GTM resources programmatically within n8n workflows. Specifically, the "Revert Variable" operation under the "Variable" resource enables reverting changes made to a GTM Variable in a specified workspace back to its previous state.

This operation is useful when you want to discard recent edits or updates to a variable and restore it to the last saved version in the GTM workspace. For example, if a variable configuration was mistakenly changed or corrupted, this revert action can quickly undo those changes without manual intervention in the GTM UI.

Properties

Name Meaning
Account ID The unique identifier of the Google Tag Manager account where the variable resides.
Container ID The identifier of the GTM container that holds the workspace and variable.
Workspace ID The workspace within the container where the variable exists and changes are tracked.
Variable ID The specific ID of the GTM variable to revert.
Optional Query Parameters Additional optional parameters for the API call. For this operation, typically empty or unused.

Output

The output is a JSON object representing the reverted GTM Variable resource as returned by the Google Tag Manager API. This includes all properties of the variable after the revert operation, reflecting its restored state.

No binary data is involved in this operation.

Dependencies

  • Requires an active Google Tag Manager API OAuth2 credential configured in n8n.
  • The node makes authenticated HTTP requests to the Google Tag Manager API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account, container, and workspace are necessary to perform revert operations.

Troubleshooting

  • Missing Required IDs: Errors will occur if any of the required identifiers (Account ID, Container ID, Workspace ID, Variable ID) are not provided. Ensure all these fields are correctly filled.
  • Authentication Errors: If the OAuth2 credentials are missing or invalid, the node will throw an error indicating missing credentials or authorization failure.
  • Permission Denied: Insufficient permissions on the GTM account or workspace may cause the API to reject the revert request.
  • Unknown Operation Error: If the operation name is incorrect or unsupported, the node will report an unknown operation error.
  • API Rate Limits: Frequent revert operations might hit Google API rate limits; handle such errors by retrying after some delay.

Links and References


This summary focuses on the "Revert Variable" operation of the Google Tag Manager node based on the provided source code and property definitions.

Discussion