View Source Plausible (Plausible Analytics v0.1.0)

Plausible is a library to push analytics event to Plausible Analytics. The library provides two working mode to push events.

Installation

  1. Add :plausible to your project mix.exs dependencies
  def deps() do
    [ #other dependendencies excluded here
      {:plausible, "~> 0.1.0"}
    ]
  end
  1. Initialize finch process in your app supervision tree.
  def start(_type, _arg) do
    children = [{Finch, name: MyApp.Finch}]
  end

Usages

The library provides two working modes as listed below

  1. Use Plausible.Client as the wrapper to Plausible module so you can pass in less parameters.
  2. Or use Plausible directly that accepts a finch process name and keyword opts parameter directly to send event to Plausible Analytics Host.

The document can be found on each Plausible and Plausible.Client

Contributions

All contributions are welcome. Please visit https://github.com/blisscs/plausible and create issue or pull request there.

Summary

Functions

Link to this function

create_event(endpoint \\ "https://plausible.io", finch_process, opts)

View Source

Create Plausible Event

Currently only returns :ok

Examples

iex> create_event(MyApp.Finch, user_agent: user_agent, x_forwarded_for: x_forwarded_for, url: url, domain: domain)
:ok