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.

Link to this section Summary

Functions

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

Removes the "www" part of a hostname.

Link to this section Types

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

Link to this section 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.