Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions102

Overview

The "Set Latest Version" operation in the Google Tag Manager (GTM) node allows users to set a specific container version as the latest version. This is useful for synchronizing workspaces and managing version control within GTM containers. By marking a version as the latest, it helps in conflict detection and error handling when multiple users or processes are working on the same container.

Common scenarios where this operation is beneficial include:

  • Coordinating development workflows by explicitly setting which container version should be considered the base for further changes.
  • Resolving conflicts in collaborative environments by updating the latest version reference.
  • Automating deployment pipelines that require programmatic control over GTM container versions.

Example use case:

  • After creating and testing a new container version, you can use this operation to mark it as the latest version so that all workspace synchronizations and conflict detections refer to this updated state.

Properties

Name Meaning
Account ID The GTM Account ID where the container resides.
Container ID The GTM Container ID for which the version will be set as latest.
Version ID The GTM Version ID to set as the latest version.
Optional Query Parameters Additional optional parameters to customize the request; none specifically required here.

Output

The output JSON contains the response from the GTM API after setting the specified container version as the latest. It typically includes details about the container version resource, such as its ID, name, description, and status.

The structure corresponds to the GTM container version object returned by the API, confirming the successful update of the latest version marker.

Dependencies

  • Requires an active Google Tag Manager API OAuth2 credential configured in n8n.
  • The node makes authenticated HTTP requests to the Google Tag Manager API endpoint: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account and container are necessary to perform version updates.

Troubleshooting

  • Missing Required IDs: Errors will occur if Account ID, Container ID, or Version ID are not provided. Ensure these fields are correctly filled.
  • Authentication Errors: If the OAuth2 credentials are missing or invalid, the node will throw an authentication error. Verify the credential setup.
  • Permission Denied: Insufficient permissions on the GTM account/container may cause API errors. Confirm that the authenticated user has appropriate access rights.
  • API Rate Limits: Frequent calls might hit Google API rate limits, resulting in temporary failures. Implement retries or backoff strategies if needed.
  • Unknown Operation Error: If the operation parameter is incorrect or unsupported, the node will throw an error indicating an unknown operation.

Links and References

Discussion