Google Tag Manager icon

Google Tag Manager

Use the Google Tag Manager API

Actions84

Overview

This node integrates with the Google Tag Manager (GTM) API, allowing users to manage various GTM resources programmatically within n8n workflows. Specifically, the "Update Account" operation under the "Account" resource enables updating details of a GTM Account.

Common scenarios for this node include automating GTM account management tasks such as updating account settings, managing containers, tags, triggers, and other GTM entities without manual intervention in the GTM web interface. For example, an organization could automate updates to GTM accounts when onboarding new clients or synchronizing account configurations across environments.

Practical example: Using the "Update Account" operation, a user can modify account-level settings by providing the account ID and the desired changes in the request body, streamlining bulk updates or integration with other systems.

Properties

Name Meaning
Account ID The unique identifier of the GTM Account to update. This is required to specify which account will be modified.
Optional Query Parameters Additional optional parameters that can influence the update operation. These include various flags and identifiers related to GTM features, such as permission updates, built-in variable types, container IDs, fingerprints, etc.
Request Body A JSON object containing the data to update on the GTM Account. This should follow the structure expected by the GTM API for account updates, specifying the fields and values to change.

The "Optional Query Parameters" collection includes many possible options, but for the "Update Account" operation, typical usage might involve:

  • allowUserPermissionFeatureUpdate (boolean): Whether to allow user permission feature updates.
  • fingerprint (string): Must match the fingerprint of the account in storage if provided.
  • Other parameters are generally more relevant to other operations/resources.

Output

The node outputs the JSON response from the Google Tag Manager API after performing the update operation. The output JSON structure corresponds to the updated GTM Account resource as returned by the API, typically including fields such as account ID, name, permissions, and other account metadata.

No binary data output is involved in this operation.

Dependencies

  • Requires valid Google Tag Manager API credentials configured in n8n (an OAuth2 API credential).
  • Internet access to call the Google Tag Manager API endpoint at https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the Google Tag Manager account 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 and connected in n8n.
  • Required Parameter Errors: The node validates required parameters like Account ID before making the API call. Missing these will cause errors; ensure all required fields are filled.
  • API Errors: Errors returned from the GTM API (e.g., permission denied, invalid request body) will be surfaced with messages prefixed by "Error calling GTM API". Review the message and stack trace for details.
  • Fingerprint Mismatch: If using the fingerprint optional parameter, ensure it matches the current fingerprint of the account to avoid update conflicts.
  • Invalid JSON in Request Body: The request body must be valid JSON matching the GTM API schema; malformed JSON will cause errors.

Links and References


If you need further details on other operations or resources, feel free to ask!

Discussion