View Source Plausible.Client (Plausible Analytics v0.1.1)
Plausible.Client provides a wrapper to internal for calling to functions defined on Plausible module.
Usage
- Create your client module.
defmodule MyApp.Plausible do
use Plausible.Client, finch_pool_name: MyApp.Finch
endOptional options include plausbile_host_url where the base_url of self hosted plausible can be passed in.
- Once module is defined can use
create_event/1as below to send event to Plausible host.
MyApp.Plausible.create_event(user_agent: user_agent, x_forwarded_for: x_forwarded_for, url: url, domain: domain)
# returns `:ok` or `{:error, status_code, body}` or {:error, `Exception.t()`}