core.analytics ============== .. py:module:: core.analytics .. autoapi-nested-parse:: Provides the building stones for adding analytics to a site. An analytics provider can provide both user- and application-facing configuration Attributes ---------- .. autoapisummary:: core.analytics.AnyRequest Classes ------- .. autoapisummary:: core.analytics.AnalyticsProvider Module Contents --------------- .. py:type:: AnyRequest :canonical: Any .. py:class:: AnalyticsProvider(**configuration: Any) Base class and registry for analytics providers. .. py:attribute:: __slots__ :value: ('configuration',) .. py:attribute:: name :type: ClassVar[str] .. py:attribute:: configuration .. py:property:: display_name :type: str .. py:method:: url(request: AnyRequest) -> str | None .. py:property:: template :type: markupsafe.Markup :abstractmethod: .. py:method:: configure(**kwargs: Any) -> Self | None :classmethod: 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. .. py:method:: template_variables(request: AnyRequest) -> core.types.RenderData | None :abstractmethod: Returns the necessary variables for formatting the template or ``None`` if the analytics can't be rendered. .. py:method:: code(request: AnyRequest) -> markupsafe.Markup | None This function gets called for every request where this provider is active and returns the necessary html embed.