Create tag with the Google Tag Manager API

Creates a tag in a workspace. It reaches the site only after Create version and Publish version. Without firingTriggerId the tag never fires.

Identifier
google_tag_manager_create_tag

The request

POST https://connect.reportei.com/api/tools/google_tag_manager_create_tag/execute
Authorization: Bearer <merchant token>
x-customer-token: <customer token>
Content-Type: application/json
Accept: application/json

{
  "customer_toolkit": "<connection UUID>",
  "arguments": {
    "accountId": "<accountId>",
    "containerId": "<containerId>",
    "workspaceId": "<workspaceId>",
    "name": "<name>",
    "type": "<type>"
  }
}

Your system sends your customer's connection id and the tool arguments. The headers are the same as the rest of the Connect API: your product's token and your customer's token.

Parameters

ParameterTypeRequiredDescription
accountIdstringYesAccount id from List accounts.
containerIdstringYesContainer id from List containers: the number in containerId, not the GTM- code of publicId.
workspaceIdstringYesWorkspace id from List workspaces.
namestringYesName of the tag in Tag Manager.
typestringYesKind of tag, such as html for Custom HTML. For other kinds, copy type and parameter from a tag of the same kind with Get tag.
parameterarrayNoSettings of the tag, which depend on its type. A Custom HTML tag takes a template parameter with key html and the code in value.
firingTriggerIdarrayNoIds of the triggers that fire the tag, from List triggers or Create trigger. The tag fires when any of them is true.
blockingTriggerIdarrayNoIds of the triggers that block the tag, from List triggers. While any of them is true, the tag does not fire.
pausedbooleanNotrue keeps the tag from firing without deleting it.
tagFiringOptionstringNoHow often the tag fires: unlimited, once per event or once per page load.Values: unlimited, oncePerEvent, oncePerLoad
notesstringNoNotes about the tag.

Supported connections

Your customer connects their Google Tag Manager account once, with one of the modes below. The same connection serves every tool of the toolkit.

OAuth with your product's app

You register your product's OAuth app once, with POST /api/merchants/credentials/google_tag_manager, and your customer authorizes the account on a consent screen. Connect renews the token when it is about to expire.

The response

On success, Connect preserves the app's response status and body. HTTP errors returned by the app use the {error, api_error} envelope; authentication or validation can fail before execution. The X-Toolkit-Execution-Id header identifies the recorded execution, available at GET /api/tools/executions/{uuid}.

Ready for AI agents

This tool's input is a JSON Schema, available at GET /api/tools/google_tag_manager_create_tag. It becomes your agent's tool definition with no conversion.

Other Google Tag Manager tools

See all 13 tools

Toolkits in the same category

See all 100 toolkits

See Connect applied to your product.

Try it for 15 days with no card, or walk our team through your use case.