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 Folder resource and the Update Folder operation, it enables updating an existing folder within a GTM workspace. This is useful for organizing tags, triggers, variables, and other entities inside GTM by modifying folder properties such as its name or description.

Common scenarios include:

  • Renaming a folder to better reflect its contents.
  • Updating folder metadata to maintain organization standards.
  • Adjusting folder details as part of automated GTM workspace management workflows.

Example use case:

  • Automatically update folder names or descriptions based on external data or naming conventions during deployment pipelines.

Properties

Name Meaning
Account ID The GTM Account ID where the folder exists.
Container ID The GTM Container ID that contains the folder.
Workspace ID The GTM Workspace ID within the container where the folder resides.
Folder ID The unique identifier of the folder to update.
Optional Query Parameters Additional optional parameters for the request, such as allowUserPermissionFeatureUpdate.
Request Body JSON object containing the folder properties to update (e.g., name, description).

Notes on Properties

  • All IDs (Account, Container, Workspace, Folder) are required to uniquely identify the folder to update.
  • The Request Body should be a valid JSON object representing the updated folder data according to GTM API specifications.
  • Optional query parameters can modify the behavior of the update request if needed.

Output

The node outputs the JSON response from the Google Tag Manager API after updating the folder. This typically includes the updated folder's full details, such as:

  • name: The folder's name.
  • path: The API path of the folder.
  • tagManagerUrl: URL to access the folder in GTM UI.
  • Other metadata fields reflecting the folder's current state.

The output is provided as a JSON array with one element per input item processed.

Dependencies

  • Requires a valid Google Tag Manager API OAuth2 credential configured in n8n.
  • The node uses the official GTM API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account and workspace are necessary to perform updates.

Troubleshooting

  • Missing Required IDs: Errors will occur if any of the required IDs (Account ID, Container ID, Workspace ID, Folder ID) are not provided. Ensure all are correctly set.
  • Invalid Request Body: If the JSON in the Request Body is malformed or missing required folder fields, the API will reject the request.
  • Authentication Errors: Ensure the OAuth2 credentials are valid and have sufficient scopes to update folders.
  • API Errors: The node surfaces errors returned by the GTM API, including permission issues or invalid operations. Review error messages for guidance.
  • Network Issues: Connectivity problems to Google's API endpoint may cause failures; verify network access.

Links and References


This summary focuses on the "Folder" resource and "Update Folder" operation as requested, based on static analysis of the node's source code and provided property definitions.

Discussion