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, for the Zone resource and the Create Zone operation, it enables creating a new zone within a specified GTM container workspace.

A "zone" in GTM is a way to control access and permissions for different parts of a container, useful for managing complex tag setups or delegating control to different teams.

Common scenarios:

  • Automating the creation of zones when setting up new GTM containers.
  • Managing access control by programmatically adding zones as part of deployment pipelines.
  • Integrating GTM zone management into broader marketing automation workflows.

Example use case:
You have multiple teams working on different parts of your website's tagging setup. You can create zones for each team automatically via this node, ensuring proper segmentation and permission control without manual intervention in the GTM UI.

Properties

Name Meaning
Account ID The GTM Account ID where the zone will be created.
Container ID The GTM Container ID within the account where the zone will be created.
Workspace ID The GTM Workspace ID inside the container where the zone will be created.
Optional Query Parameters Additional optional parameters to customize the request.
Request Body JSON object representing the details of the zone to create, including its configuration and rules.

Details on properties relevant to Create Zone:

  • Account ID: Required to specify which GTM account to target.
  • Container ID: Required to specify the container under the account.
  • Workspace ID: Required to specify the workspace within the container.
  • Optional Query Parameters: A collection of optional flags or settings that may affect the API call behavior.
  • Request Body: The main payload containing the zone definition, such as name, description, and any specific zone configurations.

Output

The output is a JSON array where each element corresponds to the response from the GTM API for the create zone request.

  • The json output field contains the newly created zone's details as returned by the GTM API.
  • This typically includes the zone's unique ID, name, path, and other metadata.
  • No binary data is output by this node.

Dependencies

  • Requires an active connection to the Google Tag Manager API using OAuth2 credentials.
  • The node expects valid GTM API credentials configured in n8n.
  • Network access to https://www.googleapis.com/tagmanager/v2 is required.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure you have configured the Google Tag Manager OAuth2 API credentials correctly in n8n.
  • Required Parameter Errors: The node validates presence of required IDs (Account ID, Container ID, Workspace ID). Missing any of these will cause an error. Double-check that all required fields are 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.
  • Invalid Request Body: Ensure the JSON in the Request Body is well-formed and matches the expected schema for a GTM zone.

Links and References


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

Discussion