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 within n8n workflows. Specifically, the "Create Version Workspace" operation under the "Workspace" resource creates a new container version from the entities present in a specified workspace. It then deletes that workspace and sets the base container version to the newly created version.

This operation is useful when you want to finalize and publish changes made in a GTM workspace by creating a stable container version. For example, after configuring tags, triggers, and variables in a workspace, you can use this operation to create a version snapshot that can be published or used for deployment.

Properties

Name Meaning
Account ID The GTM Account ID where the workspace exists.
Container ID The GTM Container ID associated with the workspace.
Workspace ID The GTM Workspace ID from which to create the container version.
Optional Query Parameters Additional optional parameters to customize the request. See below for possible options.
Request Body JSON object representing the request body payload sent to the API (optional).

Optional Query Parameters (subset relevant to this operation)

  • allowUserPermissionFeatureUpdate (boolean): Must be true to allow user permission features update.
  • Other parameters exist but are generally not required for this operation.

Output

The output is a JSON array containing the response from the Google Tag Manager API for the "create_version" action on the workspace. This typically includes details of the newly created container version such as its ID, name, description, creation timestamp, and other metadata describing the version.

No binary data is output by this node.

Dependencies

  • Requires an OAuth2 credential configured for Google Tag Manager API access.
  • The node uses the Google Tag Manager API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account, container, and workspace are necessary to perform this operation.

Troubleshooting

  • Missing Credentials: If the Google Tag Manager API credentials are not set up or missing, the node will throw an error indicating missing credentials.
  • Required Parameter Missing: The node validates that Account ID, Container ID, and Workspace ID are provided. Omitting any of these will cause an error.
  • API Errors: Errors returned from the GTM API (e.g., permission denied, invalid IDs) will be surfaced with messages prefixed by "Error calling GTM API".
  • Operation Unknown: If an unsupported operation is selected, the node throws an "Unknown operation" error.
  • Ensure that the workspace specified is valid and accessible; otherwise, the API call will fail.

Links and References


This summary focuses on the "Workspace" resource and the "Create Version Workspace" operation as requested.

Discussion