core.analytics

Provides the building stones for adding analytics to a site.

An analytics provider can provide both user- and application-facing configuration

Attributes

AnyRequest

Classes

AnalyticsProvider

Base class and registry for analytics providers.

Module Contents

type core.analytics.AnyRequest = Any[source]
class core.analytics.AnalyticsProvider(**configuration: Any)[source]

Base class and registry for analytics providers.

__slots__ = ('configuration',)[source]
name: ClassVar[str][source]
configuration[source]
property display_name: str[source]
url(request: AnyRequest) str | None[source]
property template: markupsafe.Markup[source]
Abstractmethod:

classmethod configure(**kwargs: Any) Self | None[source]

This function gets called with the per-provider configuration defined in onegov.yml. Analytics providers may optionally access these values.

The return value is either a provider instance, or None if the provider is not available.

abstractmethod template_variables(request: AnyRequest) core.types.RenderData | None[source]

Returns the necessary variables for formatting the template or None if the analytics can’t be rendered.

code(request: AnyRequest) markupsafe.Markup | None[source]

This function gets called for every request where this provider is active and returns the necessary html embed.