View Source Plausible.Ingestion.Request (Plausible v0.0.1)

The %Plausible.Ingestion.Request{} struct stores all needed fields to create an event downstream. Pre-eliminary validation is made to detect user errors early.

Summary

Functions

Builds and initially validates %Plausible.Ingestion.Request{} struct from %Plug.Conn{}.

Removes the "www" part of a hostname.

Types

@type t() :: %Plausible.Ingestion.Request{
  domains: term(),
  event_name: term(),
  hash_mode: term(),
  hostname: term(),
  ip_classification: term(),
  pathname: term(),
  props: term(),
  query_params: term(),
  referrer: term(),
  remote_ip: term(),
  revenue_source: term(),
  scroll_depth: term(),
  timestamp: term(),
  uri: term(),
  user_agent: term()
}

Functions

Link to this function

build(conn, now \\ NaiveDateTime.utc_now())

View Source
@spec build(Plug.Conn.t(), NaiveDateTime.t()) ::
  {:ok, t()} | {:error, Ecto.Changeset.t()}

Builds and initially validates %Plausible.Ingestion.Request{} struct from %Plug.Conn{}.

Link to this function

sanitize_hostname(hostname)

View Source

Removes the "www" part of a hostname.