create_variable
Create a variable in a Google Tag Manager workspace draft by providing account, container, and workspace IDs along with the variable body; returns the created variable ID.
Instructions
Creates a variable in the workspace draft.
Changes stay in the workspace until a version is published; nothing goes live. Returns the created variable including its variableId.
Args: account_id: Numeric account ID or full resource path. container_id: Numeric container ID or full resource path. workspace_id: Numeric workspace ID; find it via list_workspaces. variable: Variable resource body. Requires 'name' and 'type'; most types also need 'parameter' (list of {'type', 'key', 'value'} dicts). Data layer variable example: {'name': 'DL - user_id', 'type': 'v', 'parameter': [{'type': 'integer', 'key': 'dataLayerVersion', 'value': '2'}, {'type': 'template', 'key': 'name', 'value': 'user_id'}]}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| variable | Yes | ||
| account_id | Yes | ||
| container_id | Yes | ||
| workspace_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||