GTM Containers

container.py

class gtm_manager.container.GTMContainer(container=None, path=None, **kwargs)[source]

Open a specific GTM Container.

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

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

  • **kwargs – Additional keyword args to initialize the base class.

property publicId

Container Public ID. Also known as the GTM-ID.

Type

str

property containerId

The Container ID uniquely identifies the GTM Container.

Type

str

property domainName

List of domain names associated with the Container.

Type

List[str]

property notes

Container Notes

Type

str

property tagManagerUrl

Auto generated link to the tag manager UI

Type

str

property usageContext

List of Usage Contexts for the Container. Valid values include: web, android, or ios.

Type

List[str]

property fingerprint

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

Type

str

property path

GTM Container’s API relative path.

Type

str

property accountId

GTM Account ID

Type

str

property name

Container display name

Type

str

property raw_body

Container raw body

Type

obj

live_version(refresh=True)[source]

Load from API and open the published GTM Version of the current container.

Parameters

refresh (bool) – If live_version has already been loaded from the API, force another API request to get the latest live_version.

Returns

An instance of gtm_manager.version.GTMVersion or None if the GTM Container has no published live version.

create_workspace(name, description='')[source]

Create a new GTM Workspace in the current GTM Container.

Parameters
  • name (str) – Workspace display name

  • description (str) – Workspace description

Returns

A new instance of the created gtm_manager.workspace.GTMWorkspace.

list_workspaces(refresh=True)[source]

Load from API and list all GTM Workspaces in this account.

Parameters

refresh (bool) – If workspaces have already been loaded from the API, force another API request to get the latest list of workspaces.

Returns

A list of gtm_manager.workspace.GTMWorkspace.

list_version_headers(refresh=True)[source]

Load from API and list all GTM Version Headers in this account.

Parameters

refresh (bool) – If version_headers have already been loaded from the API, force another API request to get the latest list of version_headers.

Returns

A list of gtm_manager.version.GTMVersionHeader.