View Source Plausible (Plausible Analytics v0.1.1)
Plausible is a library to push analytics event to Plausible Analytics.
The library provides two working mode to push events.
Installation
- Add
:plausibleto your projectmix.exsdependencies
def deps() do
[ #other dependendencies excluded here
{:plausible, "~> 0.1.0"}
]
end- Initialize
finchprocess in your app supervision tree.
def start(_type, _arg) do
children = [{Finch, name: MyApp.Finch}]
endUsages
The library provides two working modes as listed below
- Use
Plausible.Clientas the wrapper toPlausiblemodule so you can pass in less parameters. - Or use
Plausibledirectly that accepts a finch process name and keywordoptsparameter 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@spec create_event(String.t(), atom(), Keyword.t() | map()) :: :ok | {:error, Exception.t()} | {:error, Mint.Types.status(), binary()}
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
Link to this function