Actions102
- Account Actions
- Built-In Variable Actions
- Client Actions
- Container Actions
- Destination Actions
- Environment Actions
- Folder Actions
- Google Tag Configuration Actions
- Tag Actions
- Template Actions
- Transformation Actions
- Trigger Actions
- User Permission Actions
- Variable Actions
- Version Actions
- Workspace Actions
- Zone Actions
Overview
This node integrates with the Google Tag Manager (GTM) API, allowing users to manage various GTM resources programmatically within n8n workflows. Specifically, for the Folder resource and the Create Folder operation, it enables creating a new folder inside a specified GTM workspace. This is useful for organizing tags, triggers, variables, and other entities within GTM containers.
Common scenarios include:
- Automating the organization of GTM workspaces by creating folders dynamically based on project or campaign needs.
- Structuring GTM containers in bulk deployments or CI/CD pipelines.
- Managing GTM configurations programmatically without manual intervention in the GTM UI.
Example: Automatically create a folder named "Marketing Campaign" in a specific GTM workspace before deploying related tags and triggers into that folder.
Properties
| Name | Meaning |
|---|---|
| Account ID | The GTM Account ID where the folder will be created. |
| Container ID | The GTM Container ID under which the workspace exists. |
| Workspace ID | The GTM Workspace ID where the folder will be created. |
| Optional Query Parameters | Additional optional parameters to customize the request (various booleans, strings, options). |
| Request Body | JSON object representing the folder details to create (e.g., folder name and description). |
Details on key properties for Create Folder operation:
- Account ID: Required to specify the GTM account.
- Container ID: Required to specify the container within the account.
- Workspace ID: Required to specify the workspace inside the container.
- Request Body: Must contain the folder data as per GTM API specification, typically including at least the folder's name.
The Optional Query Parameters collection includes many possible parameters used across different operations but are generally not required for folder creation.
Output
The node outputs an array of JSON objects corresponding to the responses from the GTM API calls. For the Create Folder operation, the output JSON represents the newly created folder entity, including its unique ID, name, path, and other metadata as returned by the GTM API.
No binary data output is involved in this operation.
Dependencies
- Requires valid Google Tag Manager API credentials configured in n8n (an OAuth2 API credential).
- The node uses the official GTM API endpoint:
https://www.googleapis.com/tagmanager/v2. - Proper permissions on the GTM account to create folders in the specified workspace.
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 Errors: The node validates presence of required IDs (Account ID, Container ID, Workspace ID). Missing any of these will cause an error. Double-check input values.
- API Errors: Errors from the GTM API (e.g., permission denied, invalid folder data) will be surfaced with messages prefixed by "Error calling GTM API". Review the message and stack trace for details.
- Invalid JSON in Request Body: Ensure the JSON provided in the Request Body field is well-formed and matches the expected structure for a GTM folder.
Links and References
- Google Tag Manager API Documentation - Folders
- Google Tag Manager API Overview
- n8n Documentation on Credentials
This summary focuses on the Folder resource's Create Folder operation as requested, based on static analysis of the node's source code and provided property definitions.