API Reference

Google Tag Manager / API Reference

gtm_build_datalayer_variable

Tag Manager tool. Create a Data Layer Variable in GTM. Args: account_id: The GTM account ID. container_id: The GTM container ID. workspace_id: The GTM workspace ID. datalayer_key: The dataLayer key to read (e.g. 'transaction_id', 'ecommerce.purchase.value'). name: Optional variable name (default: 'DLV - {datalayer_key}').

This is a write tool: it builds datalayer variable in your Google Tag Manager account. Claude asks you to confirm before it runs.

Ask Claude

You do not call this tool yourself. Ask for the outcome and the client picks the tool:

Build datalayer variable in my Google Tag Manager account for [container id], [workspace id], [datalayer key].

It takes 4 required and 1 optional parameter.

Parameters

ParameterTypeRequiredDescription
account_idstringYesAccount Id
container_idstringYesContainer Id
workspace_idstringYesWorkspace Id
datalayer_keystringYesDatalayer Key
namestringNoName

Related Google Tag Manager tools

Before you can call it

This tool needs a connected Google Tag Manager account. The Google Tag Manager connect guide covers how to authorize it and what it unlocks, and the quickstart gets a client talking to the server in about five minutes.

Start free — 30 tool calls a month

No card required. Connect Google Ads, Meta Ads, GA4 or Search Console and ask Claude for the outcome — it picks the tool.