Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions102

Overview

The "Revert Folder" operation in this Google Tag Manager (GTM) node allows users to revert changes made to a specific folder within a GTM workspace. This is useful when you want to discard recent modifications and restore the folder to its previous state as stored in the workspace's version history.

Typical scenarios include:

  • Undoing accidental or unwanted changes to a folder's configuration.
  • Restoring a folder after testing changes that should not be kept.
  • Managing workspace versions by reverting individual folders without affecting other entities.

For example, if a user modifies tags or triggers inside a folder but decides to discard those changes, they can use this operation to revert the folder back to its last saved state.

Properties

Name Meaning
Account ID The GTM Account ID where the folder resides.
Container ID The GTM Container ID containing the folder.
Workspace ID The GTM Workspace ID where the folder exists.
Folder ID The GTM Folder ID 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 folder entity as returned by the GTM API. It contains the folder's properties restored to their previous state in the workspace.

The structure includes details such as:

  • Folder metadata (name, path, etc.)
  • Folder contents summary (if any)
  • Versioning information related to the folder 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 GTM 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 Account ID, Container ID, Workspace ID, or Folder ID are not provided. Ensure all these IDs are correctly set.
  • Permission Issues: If the OAuth2 credentials lack sufficient permissions, the API call will fail. Verify that the connected user has edit access to the specified workspace.
  • Invalid Folder ID: Providing a non-existent or incorrect Folder ID will cause errors. Double-check the folder identifier.
  • API Errors: Network issues or API quota limits may cause failures. Review error messages for details and retry as needed.

Common error message format:

Error calling GTM API: <specific error message>

Resolve by verifying input parameters, credentials, and network connectivity.

Links and References

Discussion