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, specifically enabling management of GTM Triggers among many other resources. The "Create Trigger" operation allows users to create a new trigger within a specified GTM workspace, container, and account.

Use cases include automating the creation of triggers that define when tags should fire on your website or app, such as firing a tag on page load, click events, form submissions, or custom events. This is beneficial for marketers, developers, or analysts who want to programmatically manage GTM configurations without manually using the GTM web interface.

Example: Automatically creating a trigger that fires a tag when a user clicks a specific button, enabling dynamic and automated tag deployment workflows.

Properties

Name Meaning
Account ID The unique identifier of the GTM Account where the trigger will be created.
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 trigger will be added.
Optional Query Parameters Additional optional parameters to customize the API request. Includes various flags and filters.
Request Body JSON object representing the details of the trigger to create, including its configuration.

Details on Optional Query Parameters (selected examples)

  • allowUserPermissionFeatureUpdate (boolean): Allows updating user permission features.
  • type (string option): Specifies the type of built-in variable (not directly relevant for trigger creation).
  • Other parameters exist but are mostly relevant for other operations/resources.

Output

The output is a JSON array containing the response from the Google Tag Manager API after creating the trigger. This typically includes the full representation of the newly created trigger resource, such as its ID, name, type, filter conditions, and other configuration details.

No binary data output is involved.

Dependencies

  • Requires an OAuth2 API credential configured for Google Tag Manager API access.
  • The node uses the base URL https://www.googleapis.com/tagmanager/v2.
  • Proper permissions in the Google Cloud project and GTM account are necessary to create triggers.

Troubleshooting

  • Missing Credentials: If the OAuth2 credentials are not set up or invalid, the node will throw an error indicating missing credentials.
  • Required Parameters Missing: Errors will occur if Account ID, Container ID, or Workspace ID are not provided, as these are mandatory to identify where to create the trigger.
  • Invalid Request Body: If the JSON body defining the trigger is malformed or missing required fields, the API will return an error.
  • API Errors: Any errors returned by the GTM API (e.g., permission denied, quota exceeded) will be surfaced with the message prefixed by "Error calling GTM API".
  • To resolve issues, ensure all required IDs are correctly entered, the request body is valid JSON matching GTM trigger schema, and the OAuth2 credentials have sufficient scopes.

Links and References


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

Discussion