GTM Tags

tag.py

class gtm_manager.tag.GTMTag(tag=None, path=None, parent=None, **kwargs)[source]

Open a specific GTM Tag.

Parameters
  • tag (dict) – An API representation of the GTM Tag. If provided, the resource will be not be loaded from the API. tag or path argument must be set.

  • path (str) – The API path to the resource, i.e. “accounts/1234/containers/1234/workspaces/1234/tags/123”. If provided instead of tag, the representation will be loaded from the API. path or tag argument must be set.

  • parent (str) – Required, when the instance is initialized with a tag 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 paused

Indicates whether the tag is paused, which prevents the tag from firing.

Type

bool

property setupTag

The list of setup tags. Currently we only allow one.

Type

list

property firingRuleId

Firing rule IDs. A tag will fire when any of the listed rules are true and all of its blockingRuleIds (if any specified) are false.

Type

bool

property accountId

GTM Account ID.

Type

str

property teardownTag

The list of teardown tags. Currently we only allow one.

Type

list

property priority

Represents a Google Tag Manager Parameter. # User defined numeric priority of the tag. Tags are fired asynchronously in order of priority. Tags with higher numeric value fire first. A tag’s priority can be a positive or negative value. The default value is 0.

Type

obj

property workspaceId

GTM Workspace ID.

Type

str

property parameter

The tag’s parameters.

Type

list

property parentFolderId

Parent folder id.

Type

str

property scheduleStartMs

The start timestamp in milliseconds to schedule a tag.

Type

str

property scheduleEndMs

The end timestamp in milliseconds to schedule a tag.

Type

str

property containerId

GTM Container ID.

Type

str

property tagFiringOption

Option to fire this tag.

Type

str

property tagId

The Tag ID uniquely identifies the GTM Tag.

Type

str

property blockingRuleId

Blocking rule IDs. If any of the listed rules evaluate to true, the tag will not fire.

Type

list

property tagManagerUrl

Auto generated link to the tag manager UI

Type

str

property fingerprint

The fingerprint of the GTM Tag as computed at storage time. This value is recomputed whenever the tag is modified.

Type

str

property path

GTM Tag’s API relative path.

Type

str

property firingTriggerId

Firing trigger IDs. A tag will fire when any of the listed triggers are true and all of its blockingTriggerIds (if any specified) are false.

Type

list

property name

Tag display name.

Type

str

property type

GTM Tag Type.

Type

str

property notes

User notes on how to apply this tag in the container.

Type

str

property liveOnly

If set to true, this tag will only fire in the live environment (e.g. not in preview or debug mode).

Type

bool

property blockingTriggerId

Blocking trigger IDs. If any of the listed triggers evaluate to true, the tag will not fire.

Type

list

property parameter_dict

Deepcopy of GTMParameters acceable via their key value.

Type

dict

update(refresh=False, parameter=None, **kwargs)[source]

Update the current tag. 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 GTMTag instance to prevent implicitly sending stale property data.

  • parameter (list) – gtm_manager.parameter.GTMParameter s to be merged recursivly with the exsisting parameters based on their parameter key.

  • **kwargs – Additional resource properties to update with this call.

Raises

ValueError

delete()[source]

Delete the current tag.