GTM Variables¶
variable.py
-
class
gtm_manager.variable.
GTMVariable
(variable=None, path=None, parent=None, **kwargs)[source]¶ Open a specific GTM Variable.
- Parameters
trigger (dict) – An API representation of the GTM trigger. If provided, the resource will be not be loaded from the API.
trigger
orpath
argument must be set.path (str) – The API path to the resource, i.e. “accounts/1234/containers/1234/workspaces/1234/trigger/123”. If provided instead of
trigger
, the representation will be loaded from the API.path
ortrigger
argument must be set.parent (str) – Required, when the instance is initialized with a trigger argument to explizitly set the parent path, i.e. “accounts/1234/containers/1234/workspaces/1234”
**kwargs – Additional keyword args to initialize the base class.
-
property
scheduleStartMs
¶ The start timestamp in milliseconds to schedule a variable.
- Type
str
-
property
scheduleEndMs
¶ The end timestamp in milliseconds to schedule a variable.
- Type
str
-
property
name
¶ Variable display name.
- Type
str
-
property
variableId
¶ The Variable ID uniquely identifies the GTM Variable.
- Type
str
-
property
type
¶ GTM Variable Type.
- Type
str
-
property
notes
¶ User notes on how to apply this variable in the container.
- Type
str
-
property
enablingTriggerId
¶ For mobile containers only - A list of trigger IDs for enabling conditional variables; the variable is enabled if one of the enabling triggers is true while all the disabling triggers are false. Treated as an unordered set.
- Type
list
-
property
workspaceId
¶ GTM Workspace ID.
- Type
str
-
property
tagManagerUrl
¶ Auto generated link to the tag manager UI
- Type
str
-
property
fingerprint
¶ The fingerprint of the GTM Variable as computed at storage time. This value is recomputed whenever the variable is modified.
- Type
str
-
property
path
¶ GTM Variable’s API relative path.
- Type
str
-
property
accountId
¶ GTM Account ID.
- Type
str
-
property
parameter
¶ The variable’s parameters.
- Type
list
-
property
parentFolderId
¶ Parent folder id.
- Type
str
-
property
disablingTriggerId
¶ For mobile containers only - A list of trigger IDs for disabling conditional variables; the variable is enabled if one of the enabling trigger is true while all the disabling trigger are false. Treated as an unordered set.
- Type
list
-
property
containerId
¶ GTM Container ID.
- Type
str
-
property
parameter_dict
¶ GTM parameters acceable via their key value.
- Type
dict
-
update
(refresh=False, parameter=None, **kwargs)[source]¶ Update the current variable. The GTM API does not support a partial update. Therfore, this method will send all fields expliztily set in the method arguments and those cached in the instance properties.
GTMParameters passed in a list as the
parameter
argument, will be merged recursivly with the exsisting parameters based on their parameter key.All other API resource properties can be overwritten by specifying the property name as keyword arguments on the method call.
- Parameters
refresh (bool) – Force a refresh of the entire GTMVariable instance to prevent implicitly sending stale property data.
parameter (list) –
gtm_manager.parameter.GTMParameter
list to be merged recursivly with the exsisting parameters based on their parameter key.**kwargs – Additional resource properties to update with this call.
- Raises
ValueError –