Google Tag Manager
Google Tag Manager is Google's tag management system for deploying and managing marketing, analytics, and measurement tags on websites and mobile apps without editing site code. The Google Tag Manager API v2 is a RESTful interface that provides programmatic access to a user's GTM configuration data through a hierarchy of accounts, containers, and workspaces, along with the tags, triggers, variables, and container versions defined within them. Nexla uses this API to read GTM configuration for auditing, reporting, and backup, and to create or update tags, triggers, and variables and publish new container versions as part of automated tag-governance workflows.
Power end-to-end data operations for your Google Tag Manager API with Nexla. Our bi-directional Google Tag Manager connector is purpose-built for Google Tag Manager, making it simple to ingest data, sync it across systems, and deliver it anywhere — all with no coding required. Nexla turns API-sourced data into ready-to-use, reusable data products and makes it easy to send data to Google Tag Manager or any other destination. With comprehensive monitoring, lineage tracking, and access controls, Nexla keeps your Google Tag Manager workflows fast, secure, and fully governed.
Features
Type: API
- Seamless API Integration: Connect to any endpoint as source or destination without coding, with automatic data product creation
- Visual Composition & Chaining: Build complex integrations using visual templates, chain API calls, and compose workflows with data validation and filtering
- API Proxy: Expose curated slices of your data securely with a secure and customizable API proxy that validates and transforms data on the fly
- Request optimization with intelligent batching, retry, and caching to minimize API calls and costs
Prerequisites
Nexla connects to the Google Tag Manager API v2 with OAuth 2.0, as a Google user. You need a Google account that has access to the GTM accounts and containers you want to connect, usually the account that owns the container. Nexla can only read and change what that account can access, and the role it holds on each GTM account and container limits what the credential can do.
Nexla offers two OAuth 2.0 methods:
-
OAuth 2.0 (Nexla Google app): you sign in through Nexla's Google app. No Google Cloud setup is needed.
-
OAuth 2.0 (your own Google client): you sign in through an OAuth client in your own Google Cloud project, for example when your organization only allows its own OAuth apps. Before you create the credential, set up the client:
-
In the Google Cloud console, select or create a project, and enable the Tag Manager API for it under APIs & Services > Library.
-
Set up the project's OAuth consent screen if you haven't already. While the app's publishing status is Testing, only the test users you add can authorize it, so add the Google account that will sign in.
-
Under APIs & Services > Credentials, click Create credentials > OAuth client ID, and select Web application as the application type.
-
Add
https://dataops.nexla.io/nexla-api/oauth/callbackas an Authorized redirect URI. The URI must match exactly. -
Create the client, and copy its Client ID and Client Secret. Store the secret securely.
-
Both methods request the same Google Tag Manager scopes, and request offline access so that Nexla can refresh the access token without asking you to sign in again:
https://www.googleapis.com/auth/tagmanager.readonly: read GTM configuration data.https://www.googleapis.com/auth/tagmanager.edit.containers: create and update tags, triggers, and variables in a container.https://www.googleapis.com/auth/tagmanager.edit.containerversions: create and manage container versions.https://www.googleapis.com/auth/tagmanager.publish: publish container versions.https://www.googleapis.com/auth/tagmanager.manage.accounts: read and manage account-level settings.
For details about the API, its resource hierarchy, and authorization, see the Google Tag Manager API v2 documentation.
Authenticate
Credentials required
- OAuth 2.0 (Nexla Google app)
- OAuth 2.0 (your own Google client)
Sign in with Google through Nexla's Google app. Click Authorize; no client ID or secret needed.
This method requires no credential fields.
Sign in with Google using your own Google Cloud OAuth client (Tag Manager API enabled, redirect URI https://dataops.nexla.io/nexla-api/oauth/callback).
| Field | Required | Secret | Description |
|---|---|---|---|
| Client ID | Yes | Yes | Client ID of your Google Cloud OAuth client. |
| Client Secret | Yes | Yes | Client secret of your Google Cloud OAuth client. |
Create a credential in Nexla
-
After selecting the data source/destination type, click the Add Credential tile to open the Add New Credential overlay.
-
Enter a name for the credential in the Credential Name field and a short, meaningful description in the Credential Description field.
-
Select the authentication method you want to use, and authorize Nexla:
-
OAuth 2.0 (Nexla Google app): Click the Authorize button. Sign in to Google with the account that owns the GTM container, or has access to it, and click Allow to grant the requested scopes. Google redirects you back to Nexla, and the credential is marked as authorized.
-
OAuth 2.0 (your own Google client): Enter the Client ID and Client Secret of the OAuth client from Prerequisites. Click the Authorize button, sign in to Google with the account that owns the GTM container, or has access to it, and click Allow. Google redirects you back to Nexla, and the credential is marked as authorized.
-
-
Click the Save button at the bottom of the overlay. The newly added credential will now appear in a tile on the Authenticate screen during data source/destination creation.
Nexla tests the credential by listing the GTM accounts the authorized Google account can access. Nexla stores the refresh token and gets new access tokens automatically.
The authorized Google account and its GTM roles determine which accounts, containers, and workspaces the credential can access. To use resources that only a different Google account can access, create a separate credential for that account. If you use your own Google client, keep the Client Secret confidential; if it is compromised, reset it in the Google Cloud console and update the credential.
Use as a data source
To create a new data flow, navigate to the Integrate section, and click the New Data Flow button. Select the Google Tag Manager connector tile, then select the credential that will be used to connect to Google Tag Manager, and click Next; or, create a new Google Tag Manager credential for use in this flow.
Endpoint templates
Nexla provides pre-built templates that can be used to rapidly configure data sources to ingest data from common Google Tag Manager endpoints. Select the endpoint from which this source will fetch data from the Endpoint pulldown menu. Available endpoint templates are listed in the expandable boxes below. Click on an endpoint to see more information about it and how to configure your data source for this endpoint.
Once the selected endpoint template has been configured, click the Test button to the right of the endpoint selection menu to retrieve a sample of the data that will be fetched. Sample data will be displayed in the Endpoint Test Result panel on the right, allowing you to verify that the source is configured correctly before saving.
Manual configuration
Google Tag Manager data sources can also be manually configured to ingest data from any valid Google Tag Manager API v2 endpoint, including endpoints not covered by the pre-built templates, chained API calls, or custom request parameters. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, endpoint URL, date/time and lookup macros, path to data, metadata, and request headers.
The base URL for the Google Tag Manager API v2 is https://tagmanager.googleapis.com/tagmanager/v2, and resources are addressed through a nested path — for example, accounts/{accountId}/containers/{containerId}/workspaces/{workspaceId}/tags. List endpoints wrap their results in a named array (such as tag, trigger, or variable), so set Path to Data in Response to match the relevant array (e.g., $.tag[*]). The Authorization header is managed automatically by the credential and does not need to be added manually.
Once all of the relevant settings have been configured, click the Create button in the upper right corner of the screen to save and create the new Google Tag Manager data source. Nexla will now begin ingesting data from the configured endpoint and will organize any data that it finds into one or more Nexsets.
Use as a destination
Click the + icon on the Nexset that will be sent to the Google Tag Manager destination, and select the Send to Destination option from the menu. Select the Google Tag Manager connector from the list of available destination connectors, then select the credential that will be used to connect to Google Tag Manager, and click Next; or, create a new Google Tag Manager credential for use in this flow.
Endpoint templates
Nexla provides pre-built templates that can be used to rapidly configure destinations to send data to common Google Tag Manager endpoints. Select the endpoint to which data will be sent from the Endpoint pulldown menu. Then, click on the template in the list below to expand it, and follow the instructions to configure additional endpoint settings.
Manual configuration
Google Tag Manager destinations can also be manually configured to send data to any valid Google Tag Manager API v2 endpoint. Select the Advanced tab at the top of the configuration screen, and follow the instructions in Connect to Any API to configure the API method, data format, endpoint URL, request headers, attribute exclusions, record batching, and response webhooks.
Google Tag Manager API endpoints accept JSON request bodies, and the Authorization and Content-Type headers are managed automatically by the credential. Write operations target a specific workspace via a nested path (e.g., accounts/{accountId}/containers/{containerId}/workspaces/{workspaceId}/tags), and update operations require the resource ID appended to the path. Changes to tags, triggers, and variables apply only within the target workspace until a container version is created and published.
Save & activate
Once all endpoint settings have been configured, click the Done button in the upper right corner of the screen to save and create the destination. To begin sending data to the configured Google Tag Manager endpoint, open the destination resource menu, and select Activate.
The Nexset data will not be sent to the Google Tag Manager endpoint until the destination is activated. Destinations can be activated immediately or at a later time, providing full control over data movement.