Créer un déclencheur avec l'API Google Tag Manager

Crée un déclencheur dans un workspace et renvoie son triggerId. Un déclencheur pageview sans filter se déclenche sur toutes les pages. Une condition compare une variable, comme {{Page URL}}, à une valeur ; les variables intégrées de clics et de formulaires, comme {{Click ID}}, ne fonctionnent qu'une fois activées dans le workspace, ce que ce toolkit ne fait pas.

Identifiant
google_tag_manager_create_trigger

L'appel

POST https://connect.reportei.com/api/tools/google_tag_manager_create_trigger/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": "pageview"
  }
}

Votre système envoie l'id de la connexion de votre client et les arguments de la tool. Les headers sont les mêmes que pour toute l'API Connect : le token de votre produit et celui de votre client.

Paramètres

Les descriptions des paramètres suivent la documentation officielle de l'app, en anglais.

ParamètreTypeObligatoireDescription
accountIdstringOuiAccount id from List accounts.
containerIdstringOuiContainer id from List containers: the number in containerId, not the GTM- code of publicId.
workspaceIdstringOuiWorkspace id from List workspaces.
namestringOuiName of the trigger in Tag Manager.
typestringOuiEvent that fires the trigger: pageview, domReady or windowLoaded for page loads, customEvent for a dataLayer event, click for any element, linkClick for links only, formSubmission, historyChange, timer, scrollDepth, elementVisibility, youTubeVideo, jsError, init or consentInit.Valeurs : pageview, domReady, windowLoaded, customEvent, click, linkClick, formSubmission, historyChange, timer, scrollDepth, elementVisibility, youTubeVideo, jsError, init, consentInit
filterarrayNonConditions that must all be true for the trigger to fire.
customEventFilterarrayNonOnly customEvent: conditions on the event, such as {{_event}} equals the event name pushed to the dataLayer.
autoEventFilterarrayNonOnly the triggers that listen to the page, such as linkClick, formSubmission and timer: conditions that enable the listener on a page, usually on {{Page URL}}.
waitForTagsobjectNonOnly formSubmission and linkClick: true holds the submit or the link until the tags fire.
waitForTagsTimeoutobjectNonOnly formSubmission and linkClick: how long to hold, in milliseconds.
checkValidationobjectNonOnly formSubmission and linkClick: true fires the tags only if the submit or the click is not canceled by the page, such as by a failed validation.
eventNameobjectNonOnly timer: name of the event the timer pushes.
intervalobjectNonOnly timer: milliseconds between events.
limitobjectNonOnly timer: how many events to push at most.
parameterarrayNonOther settings of the trigger, such as the scroll percentages of a scrollDepth trigger or the element of an elementVisibility trigger.
notesstringNonNotes about the trigger.

Connexions possibles

Votre client connecte son compte Google Tag Manager une seule fois, avec l'un des modes ci-dessous. La même connexion sert à toutes les tools du toolkit.

OAuth avec l'app de votre produit

Vous enregistrez une fois l'app OAuth de votre produit, avec POST /api/merchants/credentials/google_tag_manager, et votre client autorise le compte sur un écran de consentement. Connect renouvelle le token avant son expiration.

La réponse

En cas de succès, Connect conserve le statut et le corps de la réponse de l'app. Les erreurs HTTP renvoyées par l'app utilisent l'objet {error, api_error} ; l'authentification ou la validation peuvent échouer avant l'exécution. Le header X-Toolkit-Execution-Id identifie l'exécution enregistrée, consultable avec GET /api/tools/executions/{uuid}.

Prête pour les agents IA

L'input de cette tool est un JSON Schema, disponible via GET /api/tools/google_tag_manager_create_trigger. Il devient la définition de tool de votre agent sans conversion.

Autres tools Google Tag Manager

Voir les 13 tools

Toolkits de la même catégorie

Voir les 100 toolkits

Voyez Connect appliqué à votre produit.

Essayez-le pendant 15 jours sans carte, ou présentez votre cas à notre équipe.