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, the "Trigger" resource with the "Delete Trigger" operation enables users to delete a trigger from a specified GTM workspace container.

Common scenarios for this node include automating GTM management tasks such as creating, updating, or deleting triggers based on external events or conditions. For example, a marketing team could automate the removal of obsolete triggers when certain campaigns end, ensuring the GTM container stays clean and efficient.

Practical example:

  • Automatically delete a specific GTM trigger when a campaign is completed or a product is discontinued, triggered by an external event in your workflow.

Properties

Name Meaning
Account ID The unique identifier of the Google Tag Manager account where the trigger resides.
Container ID The identifier of the GTM container within the account that holds the workspace.
Workspace ID The workspace ID inside the container where the trigger exists.
Trigger ID The unique identifier of the GTM trigger to be deleted.
Optional Query Parameters Additional optional parameters for the API call, such as flags controlling user permission updates or other query options.

The Optional Query Parameters collection includes multiple possible fields, but for the Delete Trigger operation, typically only relevant parameters would be used if needed (e.g., allowUserPermissionFeatureUpdate).

Output

The output of this node is a JSON array containing the response from the Google Tag Manager API after attempting to delete the specified trigger. The structure corresponds to the API's response for the delete operation, which usually includes metadata about the deletion or confirmation of success.

No binary data is output by this node.

Dependencies

  • Requires an OAuth2 credential configured for Google Tag Manager API access.
  • The node uses the Google Tag Manager API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions must be granted to the OAuth2 credential to perform delete operations on GTM triggers.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure that a valid Google Tag Manager OAuth2 credential is configured and selected.
  • Required Parameter Errors: The node validates required parameters like Account ID, Container ID, Workspace ID, and Trigger ID. Missing any of these will cause an error. Double-check that all IDs are correctly provided.
  • API Errors: Errors returned from the GTM API (e.g., insufficient permissions, invalid IDs) will be surfaced with messages prefixed by "Error calling GTM API". Review the message and stack trace for details.
  • Permission Issues: Deleting triggers requires appropriate permissions in GTM. Ensure the authenticated user has rights to modify the specified workspace and container.
  • Incorrect IDs: Using incorrect or non-existent IDs will result in API errors. Verify IDs in the GTM interface before using them in the node.

Links and References


This summary focuses on the "Trigger" resource and the "Delete Trigger" operation as requested, based on static analysis of the provided source code and property definitions.

Discussion