Skip to main content

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.

Google Tag Manager icon

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

SourceDestination

  • 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

Before creating a Google Tag Manager credential, you need a Google account that has been granted access to the GTM account(s), container(s), and workspace(s) you want to connect. The Google Tag Manager API uses OAuth 2.0 authentication through Nexla's registered OAuth application, so no Google Cloud Console project or OAuth client setup is required on your part — you authorize access directly from Nexla using your Google account credentials.

During authorization, Nexla requests a set of Google Tag Manager scopes that cover the operations this connector performs:

  • 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 within 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 account-level configuration.

The permissions available to a credential are also constrained by the role your Google account holds on each GTM account and container. For detailed information about the Google Tag Manager API, its resource hierarchy, and authorization, refer to the Google Tag Manager API v2 documentation.

Authenticate

Create a credential in Nexla

  1. After selecting the data source/destination type, click the Add Credential tile to open the Add New Credential overlay.

  2. Enter a name for the credential in the Credential Name field and a short, meaningful description in the Credential Description field.

OAuth 2.0 Authentication

Google Tag Manager credentials in Nexla use the OAuth 2.0 authorization code flow with Nexla's registered application. Most OAuth settings are pre-configured, so you only need to authorize access with your Google account.

  1. Click the Authorize button to start the OAuth 2.0 authorization flow. You will be redirected to Google's sign-in and consent screen.

  2. Sign in with the Google account whose Google Tag Manager data Nexla should access, and click Allow to grant Nexla access to the account. You will be redirected back to Nexla, and the credential will be marked as authorized.

    The OAuth 2.0 authorization flow allows Nexla to access your Google Tag Manager account on your behalf. You will be asked to grant the tagmanager.readonly, tagmanager.edit.containers, tagmanager.edit.containerversions, tagmanager.publish, and tagmanager.manage.accounts scopes, which together allow reading GTM configuration and creating, updating, and publishing container content. The authorized Google account and its GTM role determine which accounts, containers, and workspaces are accessible through this credential — if you need to access resources owned by a different Google account, create a separate credential for that account.

Save the credential

  1. 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.

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.

List Accounts

List the GTM accounts the authenticated user has access to. This is typically the entry point for exploring a GTM configuration, and it returns the Account IDs used by the other endpoints.

  • This endpoint requires no additional parameters. It returns every account the authorized Google account can access, along with each account's ID and name.

The Account ID returned by this endpoint is required as a parent identifier for the List Containers and Get Account endpoints. For details, refer to the Google Tag Manager API accounts.list documentation.

Get Account

Get a single GTM account by ID. Use this endpoint when you need the details of a specific account, such as its name and configuration settings.

  • In the Account ID field, enter the identifier of the account to retrieve. Account IDs can be obtained from the List Accounts endpoint.

For complete details on the returned account object, refer to the Google Tag Manager API accounts.get documentation.

List Containers

List all containers in a GTM account. Containers hold the tags, triggers, and variables for a website or app, and this endpoint returns the Container IDs used by the container-scoped endpoints.

  • In the Account ID field, enter the identifier of the account whose containers should be listed. Account IDs can be obtained from the List Accounts endpoint.

For details on the returned container objects and available fields, refer to the Google Tag Manager API containers.list documentation.

Get Container

Get a single GTM container by ID. Use this endpoint to retrieve the details of a specific container, including its public ID and usage context.

  • In the Account ID field, enter the identifier of the parent account, and in the Container ID field, enter the identifier of the container to retrieve. These IDs can be obtained from the List Accounts and List Containers endpoints.

For complete details on the returned container object, refer to the Google Tag Manager API containers.get documentation.

List Workspaces

List all workspaces in a GTM container. Workspaces allow concurrent, isolated changes to a container's configuration, and this endpoint returns the Workspace IDs used by the tag, trigger, and variable endpoints.

  • In the Account ID and Container ID fields, enter the identifiers of the account and container whose workspaces should be listed. These IDs can be obtained from the List Accounts and List Containers endpoints.

For details on the returned workspace objects, refer to the Google Tag Manager API workspaces.list documentation.

Get Workspace

Get a single GTM workspace by ID. Use this endpoint to retrieve the details of a specific workspace, such as its name and description.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the workspace to retrieve. These IDs can be obtained from the List Accounts, List Containers, and List Workspaces endpoints.

For complete details on the returned workspace object, refer to the Google Tag Manager API workspaces.get documentation.

List Tags

List all tags in a GTM workspace. Use this endpoint to audit or export the tags configured in a workspace, or to obtain Tag IDs for the Get Tag endpoint.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the workspace whose tags should be listed. These IDs can be obtained from the List Accounts, List Containers, and List Workspaces endpoints.

For details on the returned tag objects and their parameters, refer to the Google Tag Manager API tags.list documentation.

Get Tag

Get a single GTM tag by ID. Use this endpoint to retrieve the full configuration of a specific tag, including its type, parameters, and firing triggers.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the parent workspace, and in the Tag ID field, enter the identifier of the tag to retrieve. Tag IDs can be obtained from the List Tags endpoint.

For complete details on the returned tag object, refer to the Google Tag Manager API tags.get documentation.

List Triggers

List all triggers in a GTM workspace. Triggers define the conditions under which tags fire, and this endpoint returns them for auditing, export, or discovery of Trigger IDs.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the workspace whose triggers should be listed. These IDs can be obtained from the List Accounts, List Containers, and List Workspaces endpoints.

For details on the returned trigger objects, refer to the Google Tag Manager API triggers.list documentation.

Get Trigger

Get a single GTM trigger by ID. Use this endpoint to retrieve the full configuration of a specific trigger, including its type and firing conditions.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the parent workspace, and in the Trigger ID field, enter the identifier of the trigger to retrieve. Trigger IDs can be obtained from the List Triggers endpoint.

For complete details on the returned trigger object, refer to the Google Tag Manager API triggers.get documentation.

List Variables

List all variables in a GTM workspace. Variables supply values used by tags and triggers, and this endpoint returns them for auditing, export, or discovery of Variable IDs.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the workspace whose variables should be listed. These IDs can be obtained from the List Accounts, List Containers, and List Workspaces endpoints.

For details on the returned variable objects, refer to the Google Tag Manager API variables.list documentation.

Get Variable

Get a single GTM variable by ID. Use this endpoint to retrieve the full configuration of a specific variable, including its type and parameters.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the parent workspace, and in the Variable ID field, enter the identifier of the variable to retrieve. Variable IDs can be obtained from the List Variables endpoint.

For complete details on the returned variable object, refer to the Google Tag Manager API variables.get documentation.

Get Container Version

Get a single GTM container version by ID. A container version is a snapshot of a container's tags, triggers, and variables at a point in time, and this endpoint retrieves that snapshot for review or backup.

  • In the Account ID and Container ID fields, enter the identifiers of the parent container, and in the Version ID field, enter the identifier of the container version to retrieve.

For complete details on the returned container version object, refer to the Google Tag Manager API versions.get documentation.

Get Live Container Version

Get the currently live (published) container version. Use this endpoint to retrieve the exact configuration that is active in production for a container, without needing to know the version ID in advance.

  • In the Account ID and Container ID fields, enter the identifiers of the container whose live version should be retrieved. These IDs can be obtained from the List Accounts and List Containers endpoints.

For complete details on the live version response, refer to the Google Tag Manager API versions.live documentation.

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.

Create Tag

Create a new tag in a GTM workspace. Use this endpoint to add tags programmatically from Nexset data — for example, provisioning standard tags across containers as part of a tag-governance workflow.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the workspace in which the tag should be created.
  • Ensure each Nexset record contains the tag definition required by the Google Tag Manager API, including at minimum the tag name and type, plus any parameters and firing trigger IDs required by that tag type.

Changes made through this endpoint apply to the target workspace and do not take effect on the live site until a container version is created and published. For the required request body fields, refer to the Google Tag Manager API tags.create documentation.

Update Tag

Update an existing tag in a GTM workspace. Use this endpoint to keep tag configuration in sync with upstream data — for example, updating tag parameters when values change in a source system.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the parent workspace, and in the Tag ID field, enter the identifier of the tag to update. Tag IDs can be obtained from the List Tags data source endpoint.
  • Include the updated tag definition in each Nexset record. The request replaces the tag's configuration, so provide the complete set of fields the tag should have.

Updates apply to the target workspace and require a new container version to be created and published before they take effect on the live site. For the required request body fields, refer to the Google Tag Manager API tags.update documentation.

Create Trigger

Create a new trigger in a GTM workspace. Use this endpoint to add firing conditions programmatically from Nexset data, so that tags can reference them.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the workspace in which the trigger should be created.
  • Ensure each Nexset record contains the trigger definition required by the Google Tag Manager API, including at minimum the trigger name and type, plus any filter conditions required by that trigger type.

New triggers apply to the target workspace and require a container version to be created and published before they take effect on the live site. For the required request body fields, refer to the Google Tag Manager API triggers.create documentation.

Update Trigger

Update an existing trigger in a GTM workspace. Use this endpoint to keep trigger configuration in sync with upstream data changes.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the parent workspace, and in the Trigger ID field, enter the identifier of the trigger to update. Trigger IDs can be obtained from the List Triggers data source endpoint.
  • Include the updated trigger definition in each Nexset record. The request replaces the trigger's configuration, so provide the complete set of fields the trigger should have.

Updates apply to the target workspace and require a new container version to be created and published before they take effect on the live site. For the required request body fields, refer to the Google Tag Manager API triggers.update documentation.

Create Variable

Create a new variable in a GTM workspace. Use this endpoint to add variables programmatically from Nexset data, so that tags and triggers can reference their values.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the workspace in which the variable should be created.
  • Ensure each Nexset record contains the variable definition required by the Google Tag Manager API, including at minimum the variable name and type, plus any parameters required by that variable type.

New variables apply to the target workspace and require a container version to be created and published before they take effect on the live site. For the required request body fields, refer to the Google Tag Manager API variables.create documentation.

Update Variable

Update an existing variable in a GTM workspace. Use this endpoint to keep variable configuration in sync with upstream data changes.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the parent workspace, and in the Variable ID field, enter the identifier of the variable to update. Variable IDs can be obtained from the List Variables data source endpoint.
  • Include the updated variable definition in each Nexset record. The request replaces the variable's configuration, so provide the complete set of fields the variable should have.

Updates apply to the target workspace and require a new container version to be created and published before they take effect on the live site. For the required request body fields, refer to the Google Tag Manager API variables.update documentation.

Create Container Version

Create a new container version (snapshot) from a workspace. This packages the workspace's current tags, triggers, and variables into a versioned snapshot that can then be published.

  • In the Account ID, Container ID, and Workspace ID fields, enter the identifiers of the workspace to snapshot.
  • Optionally include a version name and notes in the Nexset record to label the resulting container version.

Creating a container version does not make it live; use the Publish Container Version endpoint to activate a version. For the request details, refer to the Google Tag Manager API workspaces.create_version documentation.

Publish Container Version

Publish a container version, making it the live version. Use this endpoint to activate a previously created container version so that its configuration takes effect on the live site or app.

  • In the Account ID and Container ID fields, enter the identifiers of the parent container, and in the Version ID field, enter the identifier of the container version to publish.

Publishing a container version replaces the currently live version and affects the production configuration served to the container's site or app. This action requires the tagmanager.publish scope. For details, refer to the Google Tag Manager API versions.publish documentation.

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.