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, specifically enabling management of GTM Built-In Variables among many other GTM resources. The "Create Built-In Variable" operation allows users to create a new built-in variable within a specified GTM workspace. This is useful for automating and managing GTM configurations programmatically, such as setting up tracking variables that are commonly used in tag management.

Typical use cases include:

  • Automating the setup of GTM environments by creating necessary built-in variables.
  • Managing GTM workspaces and containers at scale without manual intervention.
  • Integrating GTM configuration changes into CI/CD pipelines or workflow automation.

For example, you can create a built-in variable like "Click URL" or "Page URL" in a specific GTM workspace to track user interactions automatically.

Properties

Name Meaning
Account ID The unique identifier of the Google Tag Manager account where the built-in variable will be created.
Container ID The identifier of the GTM container within the account where the built-in variable will be created.
Workspace ID The identifier of the GTM workspace inside the container where the built-in variable will be created.
Optional Query Parameters Additional optional parameters for the request:
- Allow User Permission Feature Update: Boolean flag to allow updating user permission features.
- Built-In Variable Type: Select the type of built-in variable to create (e.g., Advertiser ID, Click URL, Page URL, etc.).
- Other parameters related to copying settings, terms of service acceptance, pagination tokens, and more, mostly relevant for other operations but available here as well.

The key property for this operation is the Built-In Variable Type, which determines what kind of built-in variable will be created in GTM.

Output

The output is a JSON array containing the response from the Google Tag Manager API after creating the built-in variable. The structure corresponds to the GTM API's representation of a built-in variable resource, including details such as its type, name, and any metadata returned by the API.

No binary data is involved in this operation.

Dependencies

  • Requires an OAuth2 credential configured for Google Tag Manager API access.
  • The node uses the Google Tag Manager API v2 endpoint (https://www.googleapis.com/tagmanager/v2).
  • Proper permissions on the GTM account, container, and workspace are required to create built-in variables.

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 requires Account ID, Container ID, and Workspace ID. Missing any of these will cause an error. Make sure these IDs are correctly provided.
  • API Errors: Errors returned from the GTM API will be surfaced with messages prefixed by "Error calling GTM API". Check the message and stack trace for details.
  • Permission Issues: If the operation fails due to insufficient permissions, verify that the authenticated user has the necessary rights in GTM.
  • Invalid Built-In Variable Type: Ensure the selected built-in variable type is valid and supported by GTM.

Links and References

Discussion