Skip to content

Tag Manager

TagManager

TagManager(auth: GoogleAuth)

Read-only Google Tag Manager client (tagmanager v2).

Resources are addressed by their API paths: accounts/1, accounts/1/containers/2, accounts/1/containers/2/workspaces/3. Needs Scopes.tagmanager().

list_accounts

list_accounts() -> list[Account]

Accounts the user can see.

list_containers

list_containers(account_path: str) -> list[Container]

Containers of an account, e.g. accounts/1.

list_workspaces

list_workspaces(container_path: str) -> list[Workspace]

Workspaces of a container, e.g. accounts/1/containers/2.

list_tags

list_tags(workspace_path: str) -> list[Tag]

Tags of a workspace, e.g. accounts/1/containers/2/workspaces/3.

list_triggers

list_triggers(workspace_path: str) -> list[Trigger]

Triggers of a workspace.

list_variables

list_variables(workspace_path: str) -> list[Variable]

User-defined variables of a workspace.

list_versions

list_versions(container_path: str) -> list[VersionHeader]

Version headers (id, name, counts) of a container, newest last.

get_live_version

get_live_version(container_path: str) -> ContainerVersion

The published container version, with its tags/triggers/variables.

Account dataclass

Account(path: str, account_id: str, name: str = '', tag_manager_url: str | None = None, raw: dict[str, Any] = dict())

Container dataclass

Container(path: str, account_id: str, container_id: str, name: str = '', public_id: str = '', usage_context: list[str] = list(), domain_names: list[str] = list(), notes: str | None = None, tag_manager_url: str | None = None, raw: dict[str, Any] = dict())

public_id class-attribute instance-attribute

public_id: str = ''

The "GTM-XXXX" id used in the snippet.

Workspace dataclass

Workspace(path: str, workspace_id: str, name: str = '', description: str | None = None, tag_manager_url: str | None = None, raw: dict[str, Any] = dict())

Tag dataclass

Tag(path: str, tag_id: str, name: str = '', type: str = '', firing_trigger_ids: list[str] = list(), blocking_trigger_ids: list[str] = list(), paused: bool = False, parameters: list[dict[str, Any]] = list(), tag_manager_url: str | None = None, raw: dict[str, Any] = dict())

parameters class-attribute instance-attribute

parameters: list[dict[str, Any]] = field(default_factory=list)

The API's parameter list, as sent ({"type", "key", "value"/"list"/"map"}).

Trigger dataclass

Trigger(path: str, trigger_id: str, name: str = '', type: str = '', tag_manager_url: str | None = None, raw: dict[str, Any] = dict())

A trigger; its conditions (filter, customEventFilter...) stay in raw.

Variable dataclass

Variable(path: str, variable_id: str, name: str = '', type: str = '', parameters: list[dict[str, Any]] = list(), tag_manager_url: str | None = None, raw: dict[str, Any] = dict())

VersionHeader dataclass

VersionHeader(path: str, container_version_id: str, name: str = '', num_tags: int = 0, num_triggers: int = 0, num_variables: int = 0, deleted: bool = False, raw: dict[str, Any] = dict())

A container version without its contents (see TagManager.get_live_version).

ContainerVersion dataclass

ContainerVersion(path: str, container_version_id: str, name: str = '', description: str | None = None, tags: list[Tag] = list(), triggers: list[Trigger] = list(), variables: list[Variable] = list(), tag_manager_url: str | None = None, raw: dict[str, Any] = dict())

A container version with its tags, triggers and variables.