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, for the Zone resource and the List Zones operation, it retrieves a list of all zones within a specified GTM container workspace.

Use cases include:

  • Automating the retrieval of zone configurations for auditing or reporting.
  • Integrating GTM zone data into other systems or dashboards.
  • Building workflows that react to changes or updates in GTM zones.

Example: You can use this node to fetch all zones in a particular workspace of a GTM container to monitor or synchronize them with another system.

Properties

Name Meaning
Account ID The GTM Account ID under which the container and workspace exist.
Container ID The GTM Container ID where the workspace and zones reside.
Workspace ID The GTM Workspace ID within the container from which to list zones.
Optional Query Parameters Additional optional parameters to customize the request. For example, pagination tokens.

Details on Optional Query Parameters

  • allowUserPermissionFeatureUpdate (boolean): Allows user permission feature update if set to true.
  • pageToken (string): Token for fetching the next page of results if the list is paginated.
  • Other parameters are available but generally not relevant for listing zones.

Output

The output is a JSON array where each item represents a GTM Zone object as returned by the Google Tag Manager API. Each zone object typically includes details such as:

  • Zone ID
  • Name
  • Description
  • Path
  • Boundary definitions
  • Tag restrictions
  • Other metadata related to the zone configuration

No binary data is output by this operation.

Dependencies

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

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure you have configured and selected valid Google Tag Manager OAuth2 credentials.
  • Required Parameter Errors: The node requires Account ID, Container ID, and Workspace ID. Missing any of these will cause an error indicating which parameter is required.
  • API Errors: Errors from the GTM API (e.g., permission denied, invalid IDs) will be surfaced with messages prefixed by "Error calling GTM API". Check that the provided IDs are correct and that your API credentials have sufficient access.
  • Pagination Handling: If the result is paginated, use the pageToken optional query parameter to fetch subsequent pages.

Links and References

Discussion