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 Container resource and the List Containers operation, it lists all containers that belong to a specified GTM Account. This is useful for scenarios where you want to retrieve and process container information automatically, such as auditing your GTM setup, syncing container data with other systems, or dynamically managing tags and triggers based on container details.

Practical example:
You have multiple GTM accounts and want to fetch all containers under a specific account to display them in a dashboard or to automate container updates.

Properties

Name Meaning
Account ID The unique identifier of the GTM Account whose containers you want to list.
Optional Query Parameters Additional optional parameters to refine or control the request.
- Allow User Permission Feature Update Boolean flag to allow user permission feature updates (true/false).
- Built-In Variable Type Type of built-in variable (many predefined options like Advertiser ID, Click URL, etc.).
- Container ID ID of a container to be merged or referenced in some operations (string).
- Container Version ID GTM ContainerVersion ID; can specify "published" to get the current published version.
- Copy Settings Whether to copy tag settings from one tag to another (true/false).
- Copy Terms Of Service Must be true to accept terms of service agreements when copying tags (true/false).
- Copy Users Whether to copy users from one tag to another (true/false).
- Destination ID Destination ID linked to a GTM Container (only one of destination_id or tag_id should be set).
- Fingerprint Fingerprint string to match the account's fingerprint in storage.
- Include Google Tags Whether to include accounts associated with Google Tag (true/false).
- Page Token Continuation token for fetching the next page of results (string).
- Setting Source Source of config setting after combine: Current, Other, or Unspecified.
- Tag ID Tag ID for a GTM Container (only one of destination_id or tag_id should be set).
- Tag Name Name for a newly created tag (string).
- Trigger ID Triggers to be moved to a folder (string).
- Variable ID Variables to be moved to a folder (string).

Note: For the List Containers operation specifically, the main required property is Account ID. Other optional query parameters may be used if applicable.

Output

The output is a JSON array containing the list of containers retrieved from the GTM API for the specified account. Each container object includes details such as container ID, name, usage context, and other metadata as provided by the GTM API.

Example output structure (simplified):

[
  {
    "containerId": "123456",
    "name": "My Container",
    "usageContext": ["web"],
    "publicId": "GTM-XXXXXX",
    "fingerprint": "abc123",
    ...
  },
  ...
]

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 base URL: https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the GTM account are necessary to list containers.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure that a valid Google Tag Manager OAuth2 credential is configured and selected.
  • Required Parameter Errors: The node validates required parameters such as Account ID. If these are missing, it will throw errors indicating which parameter is required.
  • API Errors: Errors returned from the GTM API (e.g., permission denied, invalid account ID) will be surfaced with messages prefixed by "Error calling GTM API". Check the message and stack trace for details.
  • Pagination: If many containers exist, use the "Page Token" optional parameter to paginate through results.

Links and References

Discussion