properties

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package filter provides event filtering functionality.

Package properties provides the core data models and types for property configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConditionConfig added in v0.35.0

type ConditionConfig struct {
	Name string     `yaml:"name"`
	Type FilterType `yaml:"type"`
	// TestMode when true sets metadata only instead of excluding events
	TestMode   bool   `yaml:"test_mode"`
	Expression string `yaml:"expression"`
}

ConditionConfig defines a single filter condition.

type FilterType added in v0.35.0

type FilterType string

FilterType indicates the type of filter (exclude or allow).

const (
	// FilterTypeExclude removes matching events from sessions.
	FilterTypeExclude FilterType = "exclude"
	// FilterTypeAllow removes non-matching events from sessions.
	FilterTypeAllow FilterType = "allow"
)

type FiltersConfig added in v0.35.0

type FiltersConfig struct {
	Fields     []string          `yaml:"fields"`
	Conditions []ConditionConfig `yaml:"conditions"`
}

FiltersConfig defines the complete filters configuration.

func ParseFilterConfig added in v0.35.0

func ParseFilterConfig(configFilePath string) (FiltersConfig, error)

ParseFilterConfig reads the filters section from a YAML config file.

type NotFoundError added in v0.19.4

type NotFoundError struct {
	PropertyID string
}

func NewNotFoundError added in v0.19.4

func NewNotFoundError(propertyID string) *NotFoundError

func (*NotFoundError) Error added in v0.19.4

func (e *NotFoundError) Error() string

type Settings

type Settings struct {
	PropertyID   string
	PropertyName string
	// In some cases (like matomo) the measurement ID is the same as the property ID.
	// In other cases (like GA4) the measurement ID is a separate ID.
	PropertyMeasurementID string

	ProtocolID string

	SplitByUserID              bool
	SplitByCampaign            bool
	SplitByTimeSinceFirstEvent time.Duration
	SplitByMaxEvents           int

	SessionTimeout            time.Duration
	SessionJoinBySessionStamp bool
	SessionJoinByUserID       bool

	Filters *FiltersConfig
}

Settings holds the tracking configuration for a property.

func (Settings) FiltersSafe added in v0.35.0

func (s Settings) FiltersSafe() FiltersConfig

FiltersSafe returns the filters configuration, ensuring it is never nil.

type SettingsRegistry

type SettingsRegistry interface {
	GetByMeasurementID(trackingID string) (*Settings, error)
	GetByPropertyID(propertyID string) (*Settings, error)
}

SettingsRegistry is a registry of property configurations.

func NewStaticSettingsRegistry

func NewStaticSettingsRegistry(props []Settings, opts ...StaticSettingsRegistryOptions) SettingsRegistry

NewStaticSettingsRegistry creates a new static property source from a list of property configurations.

func NewTestSettingRegistry added in v0.13.0

func NewTestSettingRegistry(opts ...TestSettingsOption) SettingsRegistry

NewTestSettingRegistry is a test property source that returns a static property configuration.

type StaticSettingsRegistry

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

StaticSettingsRegistry is a static property settings registry that stores property settings in a map.

func (StaticSettingsRegistry) GetByMeasurementID

func (s StaticSettingsRegistry) GetByMeasurementID(trackingID string) (*Settings, error)

GetByMeasurementID gets a property configuration by tracking ID.

func (StaticSettingsRegistry) GetByPropertyID

func (s StaticSettingsRegistry) GetByPropertyID(propertyID string) (*Settings, error)

GetByPropertyID gets a property configuration by property ID.

type StaticSettingsRegistryOptions

type StaticSettingsRegistryOptions func(s *StaticSettingsRegistry)

StaticSettingsRegistryOptions are options for the static property source.

func WithDefaultConfig

func WithDefaultConfig(settings *Settings) StaticSettingsRegistryOptions

WithDefaultConfig sets the default configuration for the static property source.

type TestSettingsOption added in v0.13.0

type TestSettingsOption func(*Settings)

TestSettingsOption configures test settings.

func WithSessionTimeout added in v0.19.8

func WithSessionTimeout(d time.Duration) TestSettingsOption

WithSessionTimeout sets the session timeout for test settings.

Jump to

Keyboard shortcuts

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