Mettre à jour une balise avec l'API Google Tag Manager

Remplace toute une balise : envoyez tous les champs à conserver, tels que Get tag les renvoie, avec les modifications, car un champ omis est effacé. Passez paused à true pour arrêter une balise sans la supprimer. Le changement n'atteint le site qu'après Create version et Publish version.

Identifiant
google_tag_manager_update_tag

L'appel

POST https://connect.reportei.com/api/tools/google_tag_manager_update_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>",
    "tagId": "<tagId>",
    "name": "<name>",
    "type": "<type>"
  }
}

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.
tagIdstringOuiTag id from List tags.
fingerprintstringNonThe fingerprint from Get tag: if the tag changed since then, Google refuses the update.
namestringOuiName of the tag in Tag Manager.
typestringOuiKind 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.
parameterarrayNonSettings of the tag, which depend on its type. A Custom HTML tag takes a template parameter with key html and the code in value.
firingTriggerIdarrayNonIds of the triggers that fire the tag, from List triggers or Create trigger. The tag fires when any of them is true.
blockingTriggerIdarrayNonIds of the triggers that block the tag, from List triggers. While any of them is true, the tag does not fire.
pausedbooleanNontrue keeps the tag from firing without deleting it.
tagFiringOptionstringNonHow often the tag fires: unlimited, once per event or once per page load.Valeurs : unlimited, oncePerEvent, oncePerLoad
notesstringNonNotes about the tag.
liveOnlybooleanNontrue fires the tag only in the live environment, not in preview.
priorityobjectNonFiring priority as an integer parameter: tags with a higher value fire first. The default is 0.
scheduleStartMsstringNonStart of the firing schedule, in milliseconds since 1970, as text.
scheduleEndMsstringNonEnd of the firing schedule, in milliseconds since 1970, as text.
parentFolderIdstringNonFolder id of the tag, from Get tag.
consentSettingsobjectNonConsent the tag checks before firing.
monitoringMetadataobjectNonA map parameter with key and value pairs added to the event data for tag monitoring. Its entries are template parameters without variables.
monitoringMetadataTagNameKeystringNonKey under which the tag name goes in monitoringMetadata. Empty leaves it out.
setupTagarrayNonTag that fires before this one.
teardownTagarrayNonTag that fires after this one.

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