PrivatusAnalytics.Components (Privatus Analytics v1.0.0)

Copy Markdown View Source

Phoenix function components.

Put the tag in the <head> of your root layout:

<PrivatusAnalytics.Components.tag nonce={assigns[:csp_nonce]} conn={@conn} />

Every attribute is optional. An attribute you leave out uses your config.

Summary

Functions

The Privatus Analytics script tag.

Functions

tag(assigns)

The Privatus Analytics script tag.

Without a site id or when the tag is not enabled, prints only the queue stub (with queue_stub={true}) or nothing.

Attributes

  • site_id (:string) - Overrides the site id.
  • script_host (:string) - Overrides the script host.
  • modules (:list) - Tracker modules, for example ["engage", "auto"].
  • excluded_paths (:list) - Path globs the tracker never counts.
  • domains (:any) - Hostnames to count.
  • spa (:string) - One of auto, history, hash or off.
  • manual (:boolean) - true turns off the automatic pageview.
  • enabled (:boolean) - true or false forces the tag on or off.
  • enabled_environments (:list) - Environments that get the tag.
  • env (:atom) - The current environment.
  • extra_attributes (:any) - Other data-* attributes, as a map.
  • nonce (:string) - Content Security Policy nonce for the script tags.
  • props (:any) - Page properties, for example %{plan: "pro"}.
  • queue_stub (:boolean) - true prints the queue stub before the tag.
  • conn (:any) - The conn, for props set with put_props/2 and the nonce assign.