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. Specifically, for the Tag resource and the Delete Tag operation, it enables deleting a specific tag within a GTM workspace. This is useful in scenarios where you want to automate the cleanup or management of tags in your GTM containers without manually accessing the GTM web interface.
Practical examples include:
- Automatically removing deprecated or unused tags from a GTM workspace.
- Integrating tag deletion as part of a larger automated deployment or version control workflow for GTM configurations.
- Cleaning up tags based on external triggers or conditions detected in other systems.
Properties
| Name | Meaning |
|---|---|
| Account ID | The unique identifier of the GTM Account that contains the container. |
| 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 tag exists. |
| Tag ID | The unique identifier of the GTM Tag to be deleted. |
| Optional Query Parameters | Additional optional parameters to customize the request. For example: |
| - Allow User Permission Feature Update (boolean): Must be true to allow user permission changes. | |
| - Fingerprint (string): Used for concurrency control; must match the stored fingerprint. | |
| - Other parameters exist but are generally not relevant for tag deletion. |
Output
The output is a JSON array containing the response from the GTM API after attempting to delete the specified tag. Typically, for a delete operation, the API returns an empty object {} or confirmation of deletion. The node parses this response and outputs it as JSON.
No binary data is involved in this operation.
Dependencies
- Requires valid Google Tag Manager API credentials configured in n8n (an OAuth2 API credential).
- The node uses the Google Tag Manager v2 REST API endpoint (
https://www.googleapis.com/tagmanager/v2).
Troubleshooting
- Missing Required IDs: If any of the required identifiers (Account ID, Container ID, Workspace ID, Tag ID) are missing, the node will throw an error indicating which ID is required.
- Authentication Errors: If the Google Tag Manager API credentials are missing or invalid, the node will fail with an authentication error.
- Fingerprint Mismatch: If using the optional fingerprint parameter and it does not match the current stored fingerprint, the operation will fail. Ensure the fingerprint is up-to-date.
- Permission Issues: If the authenticated user lacks permissions to delete the tag, the API will return an authorization error.
- Unknown Operation: If the operation name is incorrect or unsupported, the node will throw an "Unknown operation" error.
To resolve errors:
- Verify all required IDs are correctly provided.
- Confirm that the OAuth2 credentials are properly set up and authorized.
- Check user permissions in GTM for the account/container/workspace.
- Avoid or correctly use optional query parameters like fingerprint.
Links and References
- Google Tag Manager API Documentation
- Google Tag Manager Tags Resource
- n8n Documentation on Credentials
If you need details on other operations or resources, feel free to ask!