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 Create Container operation, it enables creating a new GTM container within a specified GTM account.

This functionality is useful in scenarios where you want to automate the setup of GTM containers as part of your deployment or configuration workflows. For example, marketing teams or developers can create containers dynamically when setting up new websites or applications, ensuring consistent tagging and tracking configurations without manual intervention.

Properties

Name Meaning
Account ID The identifier of the GTM Account under which the new container will be created. This is required to specify the scope of the container creation.
Optional Query Parameters Additional optional parameters that can modify the behavior of the request. These include:
- Allow User Permission Feature Update (boolean)
- Built-In Variable Type (various predefined options)
- Container ID (string)
- Container Version ID (string)
- Copy Settings (boolean)
- Copy Terms Of Service (boolean)
- Copy Users (boolean)
- Destination ID (string)
- Fingerprint (string)
- Include Google Tags (boolean)
- Page Token (string)
- Setting Source (options: Current, Other, Unspecified)
- Tag ID (string)
- Tag Name (string)
- Trigger ID (string)
- Variable ID (string)
Request Body JSON object representing the body of the request to create the container. This typically includes the container's configuration details such as name, usage context, and other relevant settings.

Output

The output of this operation is a JSON object representing the newly created GTM container. This object contains all the details returned by the Google Tag Manager API about the container, including its unique identifiers, configuration, and metadata.

No binary data is produced by this node operation.

Dependencies

  • Requires an active connection to the Google Tag Manager API.
  • Requires valid OAuth2 credentials configured in n8n for authenticating requests to the Google Tag Manager API.
  • The node uses the base URL https://www.googleapis.com/tagmanager/v2 for API calls.

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 the presence of required parameters such as Account ID before making the API call. If these are missing, the node will throw an error indicating which parameter is required.
  • API Call Failures: Errors from the Google Tag Manager API are caught and rethrown with additional context. Common issues might include invalid Account IDs, insufficient permissions, or malformed request bodies. Verify the correctness of input parameters and the permissions of the authenticated user.
  • Unknown Operation Error: If an unsupported operation is selected, the node will throw an "Unknown operation" error. Ensure the operation matches the supported list.

Links and References

Discussion