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 Clients within a workspace. The "Create Client" operation allows users to create a new client entity in a specified GTM account, container, and workspace. This is useful for automating the setup or modification of GTM clients programmatically, such as when managing multiple GTM environments or deploying configurations at scale.

Practical examples include:

  • Automatically creating new GTM clients during deployment pipelines.
  • Managing GTM clients across multiple containers or workspaces without manual intervention.
  • Integrating GTM client creation into broader marketing or analytics workflows.

Properties

Name Meaning
Account ID The GTM Account ID where the client will be created.
Container ID The GTM Container ID within the account.
Workspace ID The GTM Workspace ID inside the container where the client will be created.
Optional Query Parameters Additional optional parameters that can modify the request behavior (e.g., feature flags).
Request Body JSON object representing the client data to be created, including all necessary client details.

Details on Optional Query Parameters (subset relevant to this operation):

  • allowUserPermissionFeatureUpdate (boolean): Allows updating user permission features if set to true.
  • Other parameters exist but are generally not required for client creation.

Output

The node outputs an array of JSON objects representing the response from the GTM API after creating the client. The output JSON structure corresponds to the GTM Client resource as returned by the API, typically including fields like client ID, name, type, and other metadata related to the created client.

No binary data output is involved.

Dependencies

  • Requires valid Google Tag Manager API credentials configured in n8n (an OAuth2 API credential).
  • The node makes authenticated HTTP requests to the GTM API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account, container, and workspace are necessary to perform client creation.

Troubleshooting

  • Missing Credentials: If the Google Tag Manager API credentials are not set up or invalid, the node will throw an error indicating missing credentials.
  • Required Parameter Missing: Errors will occur if any of the required IDs (Account ID, Container ID, Workspace ID) or the request body is missing or empty.
  • API Errors: Any errors returned by the GTM API (such as permission denied, invalid data, or quota exceeded) will be surfaced with the message prefixed by "Error calling GTM API".
  • Invalid JSON in Request Body: Ensure the Request Body property contains valid JSON matching the expected client schema; otherwise, the API call will fail.

Links and References


This summary focuses on the "Client" resource and the "Create Client" operation as requested, based on static analysis of the provided source code and input properties.

Discussion