Google Tag Manager (Improved) icon

Google Tag Manager (Improved)

Use the Google Tag Manager API

Built-In Variable → Create Built-In Variable

AI-generated

Overview

This node operation creates a Built-In Variable in Google Tag Manager (GTM) within a specified account, container, and workspace. It is useful for automating the management of GTM built-in variables, which are predefined variables that GTM provides to track common data points such as clicks, page URLs, or user interactions. For example, a user can programmatically add a new built-in variable to a GTM workspace to track a specific event or data point without manually configuring it in the GTM interface.

Use Case Examples

  1. Automatically create a built-in variable in a GTM workspace to track user clicks on a website.
  2. Add a built-in variable to capture the page URL for analytics purposes in GTM via an automated workflow.

Properties

Name Meaning
Account ID The GTM Account ID where the built-in variable will be created.
Container ID The GTM Container ID within the account where the built-in variable will be created.
Workspace ID The GTM Workspace ID within the container where the built-in variable will be created.
Optional Query Parameters Additional optional parameters for the API request, including the type of built-in variable to create and other flags.

Output

JSON

  • accountId - The GTM Account ID used in the operation.
  • containerId - The GTM Container ID used in the operation.
  • workspaceId - The GTM Workspace ID used in the operation.
  • builtInVariable - The created built-in variable object returned from the GTM API.

Dependencies

  • Google Tag Manager API with OAuth2 credentials

Troubleshooting

  • Ensure that the Account ID, Container ID, and Workspace ID are provided; missing any of these will cause an error.
  • Verify that the OAuth2 credentials for Google Tag Manager API are correctly configured and authorized.
  • If the operation fails, check that the specified built-in variable type is valid and supported by GTM.
  • Common error messages include missing required parameters or authorization errors; resolving these involves providing the missing IDs or reauthorizing the API credentials.

Links

Discussion