Documentation ¶
Index ¶
- type CookieConsent
- type StaticMetadata
- type Umami
- func (Umami) CaddyModule() caddy.ModuleInfo
- func (p *Umami) GetAllowed(r *http.Request) int
- func (p *Umami) GetClientIP(r *http.Request) string
- func (p *Umami) GetClientInfo(r *http.Request, payload map[string]interface{})
- func (p *Umami) Provision(ctx caddy.Context) error
- func (p Umami) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (p *Umami) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (p *Umami) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CookieConsent ¶ added in v0.8.1
type CookieConsent struct { // The name of the cookie that stores the consent setting. Name string `json:"name,omitempty"` // Can be "disable_all" to disable sending analytics if the cookie value is "false", // or "path_only" to send analytic data without client information (IP, user agent, etc.) if the cookie value is "false". // Defaults to "disable_all" if not specified. Behavior string `json:"behavior,omitempty"` }
Cookie-based consent settings.
type StaticMetadata ¶ added in v0.9.0
type StaticMetadata struct { // The key of the metadata. Key string `json:"key,omitempty"` // The value of the metadata. Value string `json:"value,omitempty"` }
Optional static metadata to include with each event via query string.
func ParseCaddyfileStaticMetadata ¶ added in v0.9.0
func ParseCaddyfileStaticMetadata(d *caddyfile.Dispenser) ([]StaticMetadata, error)
type Umami ¶
type Umami struct { // The address of your Umami installation's send API endpoint. EventEndpoint string `json:"event_endpoint"` // The UUID of the website you want to track. WebsiteUUID string `json:"website_uuid"` // A map of page path extensions that should be reported to Umami. You must include the leading dot. AllowedExtensions []string `json:"allowed_extensions,omitempty"` // The header to send the client IP address to Umami with. ClientIPHeader string `json:"client_ip_header,omitempty"` // Enables reporting of all resources (ignoring extension checks). ReportAllResources bool `json:"report_all_resources,omitempty"` // The header to use to get the client IP address from, behind a trusted reverse proxy. TrustedIPHeader string `json:"trusted_ip_header,omitempty"` // A map of cookie-based consent settings. Only the first value in the map is utilized currently. CookieConsent []CookieConsent `json:"cookie_consent,omitempty"` // The name of the cookie that stores the visitor's screen resolution. CookieResolution string `json:"cookie_resolution,omitempty"` // Enable rudimentary device detection based on Sec-CH-UA-Mobile and Sec-CH-UA-Platform headers. DeviceDetection bool `json:"device_detection,omitempty"` // Optional static metadata to include with each event via query string. StaticMetadata []StaticMetadata `json:"static_metadata,omitempty"` // contains filtered or unexported fields }
A Caddy module which sends visitor information to Umami's Events REST API endpoint.
func (Umami) CaddyModule ¶
func (Umami) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*Umami) GetAllowed ¶ added in v0.8.0
Check whether analytics should be performed based on cookie consent settings. 0 - no analytics 1 - all analytics 2 - only path analytics
func (*Umami) GetClientIP ¶ added in v0.8.0
Get the client IP address from the request. If a trusted IP header is provided, use that instead. If the client opted-out, replace the IP address with a psuedo Class E IP address.
func (*Umami) GetClientInfo ¶ added in v0.8.0
Get client information from the request.
func (*Umami) UnmarshalCaddyfile ¶
UnmarshalCaddyfile implements caddyfile.Unmarshaler.