Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions102

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 Zone resource and the Delete Zone operation, it enables deleting a specified zone from a GTM container workspace.

Use cases include automating the cleanup or management of GTM zones as part of deployment pipelines, ensuring that obsolete or unwanted zones are removed without manual intervention. For example, after testing or migrating tags and triggers, you might want to delete specific zones automatically.

Properties

Name Meaning
Account ID The unique identifier of the GTM Account where the zone exists.
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 zone is located.
Zone ID The unique identifier of the GTM Zone to be deleted.
Optional Query Parameters Additional optional parameters for the request. For this operation, typically not required.

Output

The output is a JSON array containing the response from the Google Tag Manager API after attempting to delete the specified zone. Typically, a successful deletion returns an empty object {} or confirmation details depending on the API's response.

No binary data is output by this operation.

Dependencies

  • Requires valid Google Tag Manager API credentials configured in n8n using OAuth2 authentication.
  • The node makes HTTP requests to the Google Tag Manager API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account and container are necessary to perform delete operations.

Troubleshooting

  • Missing Required IDs: If any of the required IDs (Account ID, Container ID, Workspace ID, Zone ID) are missing, the node will throw an error indicating which ID is required.
  • Authentication Errors: Ensure that the Google Tag Manager OAuth2 credentials are correctly set up and authorized.
  • Permission Denied: The authenticated user must have sufficient permissions to delete zones in the specified GTM workspace.
  • API Errors: Any errors returned by the GTM API will be wrapped and reported by the node with the message prefix "Error calling GTM API". Check the detailed error message and stack trace for more information.
  • Invalid Zone ID: Providing a non-existent or incorrect Zone ID will result in an API error.

Links and References


If you need further details about other operations or resources, feel free to ask!

Discussion