GTM Accounts

account.py

class gtm_manager.account.GTMAccount(account=None, path=None, **kwargs)[source]

Open a specific GTM account.

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

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

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

property name

Account display name

Type

str

property shareData

Whether the account shares data anonymously with Google and others

Type

bool

property tagManagerUrl

Auto generated link to the tag manager UI

Type

str

property fingerprint

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

Type

str

property path

GTM Account’s API relative path

Type

str

property raw_body

The raw asset body as returend from the API

Type

obj

property accountId

The Account ID uniquely identifies the GTM Account

Type

str

list_containers(refresh=True)[source]

Load from API and list all containers in this account.

Parameters

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

Returns

A list of gtm_manager.permission.GTMContainer.

list_permissions(refresh=True)[source]

Load from API and list all permissions in this account.

Parameters

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

Returns

A list of gtm_manager.permission.GTMPermission.

update(name, shareData)[source]

Update the current accounts name and shareData parameters via the API.

Parameters
  • name (str) – Account display name

  • shareData (bool) – Share data setting

create_container(name, usage_context='web', domain_name=None, notes=None)[source]

Create a new container in the current account.

Parameters
  • name (str) – Container display name

  • usage_context (str) – Usage Contexts for the Container. Valid values include: web, android, or ios.

  • domain_name (str) – List of domain names associated with the Container.

  • notes (str) – Container notes