Create GTM Variable
gtm_create_variableCreate a new Google Tag Manager variable in a specified workspace by supplying account, container, and workspace IDs, a name, and a variable type. Supports constants, data layer values, cookies, and custom JavaScript.
Instructions
Create a new variable in a workspace.
Common variable types:
c: Constant
v: Data Layer Variable
k: First Party Cookie
jsm: Custom JavaScript
j: JavaScript Variable
u: URL
r: HTTP Referrer
aev: Auto-Event Variable
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name for the variable | |
| type | Yes | Variable type (c, v, k, jsm, j, u, r, aev, etc.) | |
| account_id | Yes | The GTM account ID | |
| parameters | No | Array of parameter objects. Supports nested structures with list/map | |
| container_id | Yes | The GTM container ID | |
| workspace_id | Yes | The GTM workspace ID |