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. Specifically, the "Trigger" resource with the "Get Trigger" operation enables retrieving detailed information about a specific GTM trigger within a workspace and container.

Common scenarios for this node include:

  • Automating retrieval of trigger configurations for auditing or reporting.
  • Integrating GTM trigger data into workflows for dynamic tag management.
  • Synchronizing trigger settings across multiple GTM containers or workspaces.

For example, a user can input their GTM Account ID, Container ID, Workspace ID, and Trigger ID to fetch the configuration details of that trigger, which can then be used downstream in automation processes.

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 containing the trigger.
Workspace ID The workspace within the container where the trigger is defined.
Trigger ID The specific ID of the trigger to retrieve.
Optional Query Parameters Additional optional parameters to customize the API request.

The Optional Query Parameters collection includes many possible fields, but for the "Get Trigger" operation, typically no additional parameters are required.

Output

The node outputs an array of JSON objects representing the retrieved trigger(s). For the "Get Trigger" operation, the output JSON contains the full details of the specified GTM trigger, including its configuration, conditions, and metadata as returned by the GTM API.

The output structure corresponds directly to the Google Tag Manager API's trigger resource representation, which may include fields such as:

  • Trigger name
  • Type
  • Filter conditions
  • Firing options
  • Metadata like creation and update timestamps

No binary data output is involved in this operation.

Dependencies

  • Requires valid Google Tag Manager API credentials configured in n8n (an OAuth2 API credential).
  • Internet access to call the Google Tag Manager API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account to read trigger information.

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 Missing: Errors indicating missing Account ID, Container ID, Workspace ID, or Trigger ID mean these must be provided for the operation to succeed.
  • API Errors: Errors from the GTM API (e.g., 404 Not Found) usually indicate incorrect IDs or insufficient permissions.
  • Unknown Operation: This node only supports predefined operations; ensure "Get Trigger" is selected under the "Trigger" resource.

To resolve errors:

  • Double-check all required IDs for correctness.
  • Verify that the authenticated user has access rights to the specified GTM entities.
  • Review the GTM API quota and limits if requests fail unexpectedly.

Links and References


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

Discussion