Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions102

Overview

The "Sync Workspace" operation in the Google Tag Manager (GTM) node synchronizes a specified GTM workspace with the latest container version. This means it updates all unmodified entities in the workspace to match the most recent published container version and identifies conflicts for any modified entities. This operation is useful when you want to keep your workspace up-to-date with the latest container changes while managing potential merge conflicts.

Common scenarios include:

  • Keeping a development or staging workspace synchronized with the live container version.
  • Preparing a workspace for publishing by ensuring it reflects the latest container state.
  • Detecting and resolving conflicts before finalizing changes in a workspace.

Example: A user working on tag configurations in a GTM workspace can use this operation to sync their workspace with the latest container version, ensuring they are working on the most current setup and identifying any conflicting changes that need resolution.

Properties

Name Meaning
Account ID The GTM Account ID where the workspace resides.
Container ID The GTM Container ID associated with the workspace.
Workspace ID The GTM Workspace ID to be synchronized.
Optional Query Parameters Additional optional parameters to customize the sync operation. These include:
- Allow User Permission Feature Update (boolean): Must be true to allow user permissions feature update.
- Built-In Variable Type (options): Various built-in variable types (not typically used in sync).
- Copy Settings (boolean): Whether to copy tag settings (not directly relevant here).
- Copy Terms Of Service (boolean): Acceptance of terms of service agreements (not directly relevant here).
- Copy Users (boolean): Whether to copy users (not directly relevant here).
- Fingerprint (string): Must match the fingerprint of the account if provided.
- Include Google Tags (boolean): Whether to include accounts associated with Google Tag (not typical here).
- Page Token (string): For pagination (not typical here).
- Setting Source (options): Source of config setting after combine (not typical here).
- Other parameters related to other resources are available but not relevant for this operation.

Output

The output JSON contains the response from the GTM API after attempting to synchronize the workspace. It typically includes details about the updated workspace status, including:

  • Updated entities that were synced.
  • Conflicts detected for modified entities.
  • Metadata about the workspace state post-sync.

The exact structure depends on the GTM API response for the workspacesSync endpoint but generally provides information necessary to understand what was updated and what conflicts exist.

No binary data is output by this operation.

Dependencies

  • Requires an active Google Tag Manager API OAuth2 credential configured in n8n.
  • The node uses the Google Tag Manager API base URL: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account, container, and workspace are required to perform synchronization.

Troubleshooting

  • Missing Required IDs: Errors will occur if Account ID, Container ID, or Workspace ID are not provided. Ensure these are correctly set.
  • API Credential Issues: If the OAuth2 credentials are missing or invalid, the node will throw an error indicating missing credentials.
  • Permission Denied: Insufficient permissions on the GTM account or container may cause API errors.
  • Conflict Errors: The sync operation may report conflicts if there are modified entities in the workspace that differ from the latest container version. These must be resolved manually or via the appropriate conflict resolution operations.
  • Unknown Operation Error: If the operation name is incorrect or unsupported, an error will be thrown.

Links and References

Discussion