Actions84
- 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
Overview
This node integrates with the Google Tag Manager (GTM) API, allowing users to manage various GTM resources programmatically within n8n workflows. Specifically, the "Delete Template" operation under the "Template" resource enables users to delete a custom template from a specified GTM workspace.
Common scenarios for this node include automating GTM management tasks such as creating, updating, or deleting templates, tags, triggers, and other GTM entities without manual intervention in the GTM web interface. For example, a marketing team could automate cleanup of unused templates across multiple containers or workspaces, or integrate GTM template management into CI/CD pipelines.
Practical example:
- Automatically delete a deprecated GTM custom template from a specific workspace when a new version is published, ensuring only current templates are active.
Properties
| Name | Meaning |
|---|---|
| Account ID | The GTM Account ID where the template resides. |
| Container ID | The GTM Container ID that contains the workspace and template. |
| Workspace ID | The GTM Workspace ID within the container where the template exists. |
| Template ID | The unique ID of the GTM Template to be deleted. |
| Optional Query Parameters | Additional optional parameters to customize the request. Includes options like: |
| - Allow User Permission Feature Update (boolean): Allows user permissions feature update. | |
| - Built-In Variable Type (options): Various built-in variable types (not typically used here). | |
| - Fingerprint (string): Must match the fingerprint of the account in storage (for concurrency). | |
| - Other parameters related to GTM operations (mostly irrelevant for delete template). |
Output
The output is a JSON array containing the response from the Google Tag Manager API after attempting to delete the specified template. Typically, for a delete operation, the API returns an empty object {} or confirmation of deletion.
The json output field will contain the parsed JSON response from the GTM API call. No binary data is involved in this operation.
Example output:
[{}]
Dependencies
- Requires a valid Google Tag Manager API OAuth2 credential configured in n8n.
- The node uses the Google Tag Manager v2 REST API endpoint:
https://www.googleapis.com/tagmanager/v2. - Proper permissions on the GTM account to delete templates are necessary.
Troubleshooting
- Missing Required IDs: The node requires Account ID, Container ID, Workspace ID, and Template ID to be provided. Omitting any of these will cause an error indicating which ID is missing.
- Authentication Errors: If the OAuth2 credentials are missing or invalid, the node will throw an error about missing credentials or failed authentication.
- Permission Denied: If the authenticated user does not have permission to delete templates in the specified workspace, the API will return an error.
- Fingerprint Mismatch: If using the optional fingerprint parameter, ensure it matches the current fingerprint of the account; otherwise, the operation will fail.
- Unknown Operation: If the operation name is incorrect or unsupported, the node throws an "Unknown operation" error.
To resolve errors:
- Verify all required IDs are correctly set.
- Ensure the OAuth2 credential is properly configured and authorized.
- Confirm the user has sufficient permissions in GTM.
- Avoid or correctly use optional query parameters like fingerprint.
Links and References
- Google Tag Manager API Documentation
- Google Tag Manager API Reference - Templates
- n8n OAuth2 Credential Setup
This summary focuses on the "Delete Template" operation of the "Template" resource based on the provided source code and properties.