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, enabling users to manage various GTM resources programmatically within n8n workflows. Specifically, for the User Permission resource and the Create User Permissions operation, it allows creating user permissions that define a user's access to GTM accounts and containers.

Typical use cases include automating the management of user access rights in GTM, such as granting new team members appropriate permissions or updating access levels without manual intervention in the GTM web interface.

Example: Automatically create user permissions for a new employee by specifying their access details, streamlining onboarding processes.

Properties

Name Meaning
Account ID The Google Tag Manager Account ID where the user permission will be created.
Optional Query Parameters Additional optional parameters for the request. For this operation, these can include:
- Allow User Permission Feature Update: Boolean to allow feature update.
Other parameters are available but may not apply here.
Request Body JSON object containing the details of the user permission to create. This typically includes user email, permissions granted, and other relevant configuration according to GTM API requirements.

Output

The node outputs an array of JSON objects representing the response from the GTM API after creating the user permission(s). The structure corresponds to the GTM API's user permission resource representation, which generally includes fields like:

  • accountId: The account ID associated with the permission.
  • userPermissionId: The unique identifier of the created user permission.
  • emailAddress: The email address of the user granted permission.
  • permissions: Details about the level of access granted at the account and container levels.

No binary data is output by this node.

Dependencies

  • Requires valid Google Tag Manager API credentials configured in n8n using OAuth2 authentication.
  • The node uses the Google Tag Manager API endpoint https://www.googleapis.com/tagmanager/v2.
  • Proper permissions on the Google Cloud project and GTM account to create user permissions are necessary.

Troubleshooting

  • Missing Credentials Error: If the node throws an error about missing credentials, ensure that the Google Tag Manager OAuth2 API credentials are properly set up in n8n.
  • Required Parameter Errors: The node validates required parameters such as Account ID before making API calls. Ensure all mandatory fields are filled.
  • API Errors: Errors returned from the GTM API (e.g., insufficient permissions, invalid request body) will be surfaced with messages prefixed by "Error calling GTM API". Review the message and stack trace for details.
  • Feature Update Flag: When updating user permissions that enable the user permissions feature, the allowUserPermissionFeatureUpdate flag must be set to true; otherwise, the operation will fail.

Links and References

Discussion