Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions84

Overview

The "Get Folder" operation of the Google Tag Manager (GTM) node retrieves detailed information about a specific folder within a GTM workspace. This operation is useful when you want to access metadata or configuration details of a particular folder in your GTM container workspace, such as its name, path, or contents.

Common scenarios include:

  • Auditing or reviewing folder configurations before making changes.
  • Integrating GTM folder data into automated workflows for reporting or synchronization.
  • Fetching folder details to validate existence or properties before performing further operations like updates or moves.

Example use case:

  • You have multiple folders organizing tags and triggers in your GTM workspace, and you want to programmatically fetch the details of a specific folder by its ID to display or process it in your automation.

Properties

Name Meaning
Account ID The unique identifier of the GTM Account that contains the folder.
Container ID The unique identifier of the GTM Container within the account.
Workspace ID The unique identifier of the GTM Workspace inside the container where the folder exists.
Folder ID The unique identifier of the GTM Folder to retrieve.
Optional Query Parameters Additional optional parameters to customize the API request (e.g., feature flags).

Output

The output is a JSON object representing the folder's details as returned by the GTM API. It typically includes fields such as:

  • name: The full API path of the folder resource.
  • folderId: The unique ID of the folder.
  • name: The display name of the folder.
  • notes: Any notes or description associated with the folder.
  • path: The API path to the folder.
  • Other metadata related to the folder's configuration and state.

This JSON output allows downstream nodes or processes to consume folder information for further automation or analysis.

Dependencies

  • Requires an active Google Tag Manager API OAuth2 credential configured in n8n to authenticate requests.
  • The node uses the official GTM API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account, container, and workspace are necessary to access folder details.

Troubleshooting

  • Missing Required IDs: If any of the required IDs (Account ID, Container ID, Workspace ID, Folder ID) are missing, the node will throw an error indicating which ID is required.
  • Authentication Errors: Ensure that the OAuth2 credentials are correctly set up and authorized to access the GTM API.
  • Permission Denied: The authenticated user must have sufficient permissions to read folder information in the specified workspace.
  • Invalid Folder ID: Providing a non-existent or incorrect Folder ID will result in an API error; verify the folder ID before running the node.
  • API Rate Limits: Excessive calls may hit Google API rate limits; implement retries or backoff strategies if needed.

Links and References

Discussion