Atualizar tag no Google Tag Manager, por uma API

Substitui uma tag inteira: envie todos os campos a manter, como Get tag os retorna, com as mudanças, pois um campo omitido é apagado. Defina paused como true para parar uma tag sem excluí-la. A mudança só chega ao site depois de Create version e Publish version.

Identificador
google_tag_manager_update_tag

A chamada

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>"
  }
}

Seu sistema envia o id da conexão do cliente e os argumentos da tool. Os headers são os mesmos de toda a API do Connect: o token do seu produto e o token do cliente.

Parâmetros

As descrições dos parâmetros seguem a documentação oficial do app, em inglês.

ParâmetroTipoObrigatórioDescrição
accountIdstringSimAccount id from List accounts.
containerIdstringSimContainer id from List containers: the number in containerId, not the GTM- code of publicId.
workspaceIdstringSimWorkspace id from List workspaces.
tagIdstringSimTag id from List tags.
fingerprintstringNãoThe fingerprint from Get tag: if the tag changed since then, Google refuses the update.
namestringSimName of the tag in Tag Manager.
typestringSimKind 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.
parameterarrayNãoSettings of the tag, which depend on its type. A Custom HTML tag takes a template parameter with key html and the code in value.
firingTriggerIdarrayNãoIds of the triggers that fire the tag, from List triggers or Create trigger. The tag fires when any of them is true.
blockingTriggerIdarrayNãoIds of the triggers that block the tag, from List triggers. While any of them is true, the tag does not fire.
pausedbooleanNãotrue keeps the tag from firing without deleting it.
tagFiringOptionstringNãoHow often the tag fires: unlimited, once per event or once per page load.Valores: unlimited, oncePerEvent, oncePerLoad
notesstringNãoNotes about the tag.
liveOnlybooleanNãotrue fires the tag only in the live environment, not in preview.
priorityobjectNãoFiring priority as an integer parameter: tags with a higher value fire first. The default is 0.
scheduleStartMsstringNãoStart of the firing schedule, in milliseconds since 1970, as text.
scheduleEndMsstringNãoEnd of the firing schedule, in milliseconds since 1970, as text.
parentFolderIdstringNãoFolder id of the tag, from Get tag.
consentSettingsobjectNãoConsent the tag checks before firing.
monitoringMetadataobjectNãoA map parameter with key and value pairs added to the event data for tag monitoring. Its entries are template parameters without variables.
monitoringMetadataTagNameKeystringNãoKey under which the tag name goes in monitoringMetadata. Empty leaves it out.
setupTagarrayNãoTag that fires before this one.
teardownTagarrayNãoTag that fires after this one.

Conexões possíveis

O seu cliente conecta a conta do Google Tag Manager uma vez, por um dos modos abaixo. A mesma conexão serve para todas as tools do toolkit.

OAuth com o app do seu produto

Você cadastra o app OAuth do seu produto uma vez, em POST /api/merchants/credentials/google_tag_manager, e o cliente autoriza a conta numa tela de consentimento. O Connect renova o token quando ele está para vencer.

A resposta

Em caso de sucesso, o Connect preserva o status e o corpo da resposta do app. Erros HTTP retornados pelo app usam o envelope {error, api_error}; falhas de autenticação ou validação podem ocorrer antes da execução. O header X-Toolkit-Execution-Id identifica a execução registrada, consultável em GET /api/tools/executions/{uuid}.

Pronta para agentes de IA

O input desta tool é um JSON Schema, disponível em GET /api/tools/google_tag_manager_update_tag. Ele vira a definição de tool do seu agente sem conversão.

Outras tools do Google Tag Manager

Ver as 13 tools

Toolkits da mesma categoria

Ver os 100 toolkits

Veja o Connect aplicado ao seu produto.

Teste por 15 dias sem cartão, ou mostre seu cenário ao nosso time.