mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 09:33:19 +03:00
Support custom events and props in mix send_pageview (#2606)
This commit is contained in:
parent
166748dcf2
commit
818d4404a8
@ -15,13 +15,17 @@ defmodule Mix.Tasks.SendPageview do
|
||||
@default_domain "dummy.site"
|
||||
@default_page "/"
|
||||
@default_referrer "https://google.com"
|
||||
@default_event "pageview"
|
||||
@default_props "{}"
|
||||
@options [
|
||||
ip: :string,
|
||||
user_agent: :string,
|
||||
domain: :string,
|
||||
page: :string,
|
||||
referrer: :string,
|
||||
host: :string
|
||||
host: :string,
|
||||
event: :string,
|
||||
props: :string
|
||||
]
|
||||
|
||||
def run(opts) do
|
||||
@ -78,13 +82,16 @@ defmodule Mix.Tasks.SendPageview do
|
||||
domain = Keyword.get(opts, :domain, @default_domain)
|
||||
page = Keyword.get(opts, :page, @default_page)
|
||||
referrer = Keyword.get(opts, :referrer, @default_referrer)
|
||||
event = Keyword.get(opts, :event, @default_event)
|
||||
props = Keyword.get(opts, :props, @default_props)
|
||||
|
||||
%{
|
||||
name: "pageview",
|
||||
name: event,
|
||||
url: "http://#{domain}#{page}",
|
||||
domain: domain,
|
||||
referrer: referrer,
|
||||
width: 1666
|
||||
width: 1666,
|
||||
props: props
|
||||
}
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user