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, the "Update Version" operation under the "Version" resource enables updating a container version within a GTM account and container.

Use cases include automating updates to GTM container versions as part of deployment pipelines or workflows that require dynamic changes to tag configurations, triggers, or variables in GTM containers.

For example, you might use this node to update a specific container version with new settings or metadata after testing changes in a workspace, streamlining the release process without manual intervention in the GTM web interface.

Properties

Name Meaning
Account ID The unique identifier of the Google Tag Manager Account where the container version exists.
Container ID The unique identifier of the GTM Container associated with the version to be updated.
Version ID The identifier of the specific GTM Container Version to update.
Optional Query Parameters Additional optional parameters for the API request. These include:
- Allow User Permission Feature Update (boolean): Allows changing user permission features.
- Built-In Variable Type (select from many predefined types).
- Container ID, Container Version ID, Copy Settings (boolean), Copy Terms Of Service (boolean), Copy Users (boolean), Destination ID, Fingerprint, Include Google Tags (boolean), Page Token, Setting Source (options: current, other, unspecified), Tag ID, Tag Name, Trigger ID, Variable ID. These parameters customize the behavior of the update operation depending on the context.
Request Body A JSON object representing the body of the update request. This contains the data to update the container version with, such as configuration details or metadata.

Output

The node outputs an array of JSON objects representing the response from the Google Tag Manager API for the update operation. This typically includes the updated container version's details such as its ID, name, description, and any other metadata returned by the API.

No binary data output is involved in this operation.

Dependencies

  • Requires valid Google Tag Manager API credentials configured in n8n using OAuth2 authentication.
  • The node makes HTTP requests to the Google Tag Manager API endpoint at https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account and container are necessary to perform update operations.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure that the Google Tag Manager API OAuth2 credentials are properly set up in n8n.
  • Required Parameter Errors: The node validates required parameters like Account ID, Container ID, and Version ID. Missing any of these will cause errors. Double-check that all required IDs are provided.
  • API Errors: Errors returned from the GTM API (e.g., permission denied, invalid version ID) will be surfaced with messages prefixed by "Error calling GTM API". Review the message and stack trace for details.
  • Invalid JSON in Request Body: Ensure the JSON provided in the Request Body property is well-formed and matches the expected schema for a container version update.

Links and References

Discussion