Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions84

Overview

This node integrates with the Google Tag Manager (GTM) API, allowing users to manage various GTM resources programmatically. Specifically, for the Client resource and the Delete Client operation, it enables deleting a GTM Client within a specified workspace of a container in a GTM account.

Typical use cases include automating the cleanup or management of GTM clients as part of deployment pipelines or administrative workflows. For example, if a client configuration is no longer needed or must be removed due to changes in tracking requirements, this node can delete that client automatically without manual intervention.

Properties

Name Meaning
Account ID The GTM Account ID where the client exists.
Container ID The GTM Container ID within the account.
Workspace ID The GTM Workspace ID inside the container.
Client ID The specific GTM Client ID to delete.
Optional Query Parameters Additional optional parameters to customize the request. See below for possible options.

Optional Query Parameters (subset relevant to Delete Client)

  • allowUserPermissionFeatureUpdate (boolean): Must be set to true to allow user permission features to update; otherwise, the operation will fail.
  • Other parameters exist but are generally not applicable for the Delete Client operation.

Output

The output is a JSON array containing the response from the Google Tag Manager API after attempting to delete the specified client. Typically, a successful deletion returns an empty object or confirmation message indicating the client was deleted.

No binary data is output by this operation.

Dependencies

  • Requires valid Google Tag Manager API credentials configured in n8n (an OAuth2 API credential).
  • The node makes authenticated HTTP requests to the GTM API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account are necessary to perform deletions.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure that the Google Tag Manager OAuth2 API credentials are properly set up in n8n.
  • Required Parameter Errors: The node validates required parameters such as Account ID, Container ID, Workspace ID, and Client ID. Missing any of these will cause an error. Double-check that all IDs are correctly provided.
  • Permission Denied: If the API returns permission errors, verify that the authenticated user has sufficient rights to delete clients in the specified GTM account and workspace.
  • Operation Unknown: If an unsupported operation is selected, the node will throw an "Unknown operation" error.
  • API Errors: Any other API errors will be wrapped and reported with the prefix "Error calling GTM API". Check the detailed message and stack trace for more information.

Links and References


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

Discussion