analytics

package
v1.37.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package analytics provides Google Analytics 4 (GA4) Measurement Protocol integration for server-side event tracking from the Vulnetix CLI.

This uses the same GA4 property (G-NWBJE5RS0Q) as the Vulnetix website, enabling unified analytics across the web app and CLI.

Privacy: All tracking is anonymous. No PII is collected. Users can opt out by setting VULNETIX_NO_ANALYTICS=1 or DO_NOT_TRACK=1.

Index

Constants

View Source
const (
	CategoryCommand    = "cli_command"
	CategoryAuth       = "authentication"
	CategoryVDB        = "vulnerability_database"
	CategoryScan       = "scanning"
	CategoryError      = "error"
	CategoryEngagement = "engagement"
)

Event categories matching the website's ga4-client.ts patterns

Variables

This section is empty.

Functions

func Init

func Init(version, platform string)

Init initializes the global analytics client. Call once at startup. version is the CLI version string. platform is the detected runtime platform.

func TrackAuth

func TrackAuth(method, action string, success bool)

TrackAuth tracks an authentication event.

func TrackCommand

func TrackCommand(command string, args map[string]interface{})

TrackCommand tracks a CLI command invocation.

func TrackError

func TrackError(command, errorMsg string, fatal bool)

TrackError tracks an error occurrence.

func TrackEvent

func TrackEvent(eventName string, params map[string]interface{})

TrackEvent tracks a generic custom event.

func TrackScan

func TrackScan(scanType string, fileCount int)

TrackScan tracks a scan invocation.

func TrackVDBQuery

func TrackVDBQuery(subcommand, apiVersion string)

TrackVDBQuery tracks a VDB API query.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client sends analytics events to GA4 via the Measurement Protocol.

func NewClient

func NewClient(version, platform string) *Client

NewClient creates a new analytics client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL