eventcolumns

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package eventcolumns provides column implementations for event data tracking.

Package eventcolumns provides column implementations for event data tracking.

Package eventcolumns provides column implementations for event data tracking.

Package eventcolumns provides column implementations for event data tracking.

Package eventcolumns provides event column implementations for session-scoped data.

Package eventcolumns provides column implementations for event data tracking.

Index

Constants

This section is empty.

Variables

View Source
var ClickIDsDclidColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventClickIDDclid.ID,
	columns.CoreInterfaces.EventClickIDDclid.Field,
	"dclid",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventClickIDDclid.ID)),
	),
	columns.WithEventColumnDocs(
		"Google dclid",
		"Google Click ID from Google Display & Video 360 campaigns, extracted from the 'dclid' parameter in the page URL, used for tracking display ad clicks and conversions.",
	),
)

ClickIDsDclidColumn is the column for the DCLID of an event

View Source
var ClickIDsFbclidColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventClickIDFbclid.ID,
	columns.CoreInterfaces.EventClickIDFbclid.Field,
	"fbclid",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventClickIDFbclid.ID)),
	),
	columns.WithEventColumnDocs(
		"Facebook fbclid",
		"Meta Click ID from Meta Ads campaigns (Facebook, Instagram, WhatsApp), extracted from the 'fbclid' parameter in the page URL, used for tracking ad clicks and linking conversions to Meta Ads.",
	),
)

ClickIDsFbclidColumn is the column for the FBCLID of an event

View Source
var ClickIDsGbraidColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventClickIDGbraid.ID,
	columns.CoreInterfaces.EventClickIDGbraid.Field,
	"gbraid",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventClickIDGbraid.ID)),
	),
	columns.WithEventColumnDocs(
		"Google gbraid",
		"Google Click ID for iOS app-to-web conversions, extracted from the 'gbraid' parameter in the page URL, used for privacy-preserving attribution from iOS apps.",
	),
)

ClickIDsGbraidColumn is the column for the GBRAID of an event

View Source
var ClickIDsGclidColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventClickIDGclid.ID,
	columns.CoreInterfaces.EventClickIDGclid.Field,
	"gclid",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventClickIDGclid.ID)),
	),
	columns.WithEventColumnDocs(
		"Google gclid",
		"Google Click ID from Google Ads campaigns, extracted from the 'gclid' parameter in the page URL, used for tracking ad clicks and linking conversions to Google Ads.",
	),
)

ClickIDsGclidColumn is the column for the GCLID of an event

View Source
var ClickIDsMsclkidColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventClickIDMsclkid.ID,
	columns.CoreInterfaces.EventClickIDMsclkid.Field,
	"msclkid",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventClickIDMsclkid.ID)),
	),
	columns.WithEventColumnDocs(
		"Microsoft msclkid",
		"Microsoft Click ID from Microsoft Advertising campaigns, extracted from the 'msclkid' parameter in the page URL, used for tracking Bing/Microsoft ad clicks and conversions.",
	),
)

ClickIDsMsclkidColumn is the column for the MSCLKID of an event

View Source
var ClickIDsSrsltidColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventClickIDSrsltid.ID,
	columns.CoreInterfaces.EventClickIDSrsltid.Field,
	"srsltid",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventClickIDSrsltid.ID)),
	),
	columns.WithEventColumnDocs(
		"Google srsltid",
		"Google Shopping Result Click ID, extracted from the 'srsltid' parameter in the page URL, used for tracking clicks from Google Shopping results.",
	),
)

ClickIDsSrsltidColumn is the column for the SRSLTID of an event

View Source
var ClickIDsWbraidColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventClickIDWbraid.ID,
	columns.CoreInterfaces.EventClickIDWbraid.Field,
	"wbraid",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventClickIDWbraid.ID)),
	),
	columns.WithEventColumnDocs(
		"Google wbraid",
		"Google Click ID for iOS web-to-app conversions, extracted from the 'wbraid' parameter in the page URL, used for privacy-preserving attribution to iOS apps.",
	),
)

ClickIDsWbraidColumn is the column for the WBRAID of an event

View Source
var ClientIDColumn = columns.NewSimpleEventColumn(
	columns.CoreInterfaces.EventClientID.ID,
	columns.CoreInterfaces.EventClientID.Field,
	func(event *schema.Event) (any, error) {
		return string(event.BoundHit.ClientID), nil
	},
	columns.WithEventColumnDocs(
		"Client ID",
		"The Client ID is a unique, randomly generated identifier assigned to each device-browser pair or app installation. It is stored client-side and sent with every event, enabling the analytics system to calculate the number of unique users. It is also used as one of the identifiers that merge events into a session.",
	),
)

ClientIDColumn is the column for the client ID of an event

View Source
var EventIDColumn = columns.NewSimpleEventColumn(
	columns.CoreInterfaces.EventID.ID,
	columns.CoreInterfaces.EventID.Field,
	func(event *schema.Event) (any, error) {
		return event.BoundHit.ID, nil
	},
	columns.WithEventColumnDocs(
		"Event ID",
		"A unique event identifier, generated server-side when the hit is received, used to deduplicate events.",
	),
)

EventIDColumn is the column for the event ID of an event

View Source
var EventNameColumn = columns.NewSimpleEventColumn(
	columns.CoreInterfaces.EventName.ID,
	columns.CoreInterfaces.EventName.Field,
	func(event *schema.Event) (any, error) {
		if event.BoundHit.EventName == "" {
			return nil, columns.NewBrokenEventError("event name is empty")
		}
		return event.BoundHit.EventName, nil
	},
	columns.WithEventColumnDocs(
		"Event Name",
		"The name of the event. This identifies the action the user performed (e.g., 'page_view', 'click', 'purchase', 'sign_up').",
	),
)

EventIDColumn is the column for the event ID of an event

View Source
var GeoCityStubColumn = columns.AlwaysNilEventColumn(
	columns.CoreInterfaces.GeoCity.ID,
	columns.CoreInterfaces.GeoCity.Field,
	columns.WithEventColumnDocs(
		"City",
		stubDescription,
	),
)

GeoCityStubColumn is the column for the geo city of an event

View Source
var GeoContinentStubColumn = columns.AlwaysNilEventColumn(
	columns.CoreInterfaces.GeoContinent.ID,
	columns.CoreInterfaces.GeoContinent.Field,
	columns.WithEventColumnDocs(
		"Continent",
		stubDescription,
	),
)

GeoContinentStubColumn is the column for the geo continent of an event

View Source
var GeoCountryStubColumn = columns.AlwaysNilEventColumn(
	columns.CoreInterfaces.GeoCountry.ID,
	columns.CoreInterfaces.GeoCountry.Field,
	columns.WithEventColumnDocs(
		"Country",
		stubDescription,
	),
)

GeoCountryStubColumn is the column for the geo country of an event

View Source
var GeoMetroStubColumn = columns.AlwaysNilEventColumn(
	columns.CoreInterfaces.GeoMetro.ID,
	columns.CoreInterfaces.GeoMetro.Field,
	columns.WithEventColumnDocs(
		"Metro Area",
		stubDescription,
	),
)

GeoMetroStubColumn is the column for the geo metro of an event

View Source
var GeoRegionStubColumn = columns.AlwaysNilEventColumn(
	columns.CoreInterfaces.GeoRegion.ID,
	columns.CoreInterfaces.GeoRegion.Field,
	columns.WithEventColumnDocs(
		"Region",
		stubDescription,
	),
)

GeoRegionStubColumn is the column for the geo region of an event

View Source
var GeoSubContinentStubColumn = columns.AlwaysNilEventColumn(
	columns.CoreInterfaces.GeoSubContinent.ID,
	columns.CoreInterfaces.GeoSubContinent.Field,
	columns.WithEventColumnDocs(
		"Sub-Continent",
		stubDescription,
	),
)

GeoSubContinentStubColumn is the column for the geo subcontinent of an event

View Source
var IPAddressColumn = columns.NewSimpleEventColumn(
	columns.CoreInterfaces.EventIPAddress.ID,
	columns.CoreInterfaces.EventIPAddress.Field,
	func(event *schema.Event) (any, error) {
		return event.BoundHit.IP, nil
	},
	columns.WithEventColumnDocs(
		"IP Address",
		"The IP address (IPv4 or IPv6) from which the tracking request originates, used as the source for geolocation data.",
	),
)

IPAddressColumn is the column for the IP address of an event

View Source
var PropertyIDColumn = columns.NewSimpleEventColumn(
	columns.CoreInterfaces.EventPropertyID.ID,
	columns.CoreInterfaces.EventPropertyID.Field,
	func(event *schema.Event) (any, error) {
		return event.BoundHit.PropertyID, nil
	},
	columns.WithEventColumnDocs(
		"Property ID",
		"The unique identifier for the property that sent this event, used to distinguish between different tracked properties and route data to appropriate destinations.",
	),
)

PropertyIDColumn is the column for the property ID of an event

View Source
var SSEIsEntry = columns.NewSimpleSessionScopedEventColumn(
	columns.CoreInterfaces.SSEIsEntry.ID,
	columns.CoreInterfaces.SSEIsEntry.Field,
	func(s *schema.Session, i int) (any, error) {
		if len(s.Events) == 0 {
			return nil, nil
		}
		if i == 0 {
			return int64(1), nil
		}
		return int64(0), nil
	},
	columns.WithSessionScopedEventColumnDocs(
		"Session Is Entry Event",
		"An integer flag indicating whether this event is the first event (entry point) of the session. Returns 1 for the first event in the session, 0 for all subsequent events.",
	),
)

SSEIsEntry is a session-scoped event column that writes whether the event is the first event in the session

View Source
var SSESessionHitNumber = columns.NewSimpleSessionScopedEventColumn(
	columns.CoreInterfaces.SSESessionHitNumber.ID,
	columns.CoreInterfaces.SSESessionHitNumber.Field,
	func(_ *schema.Session, i int) (any, error) {
		return int64(i), nil
	},
	columns.WithSessionScopedEventColumnRequired(false),
	columns.WithSessionScopedEventColumnDocs(
		"Session Hit Number",
		"The sequential number of this event within its session, starting from 0. This is the index position of the event in the chronological sequence of all events in the same session.",
	),
)

SSESessionHitNumber is a session-scoped event column that writes the index of the event within the session

View Source
var SSESessionPageNumber = columns.NewSimpleSessionScopedEventColumn(
	columns.CoreInterfaces.SSESessionPageNumber.ID,
	columns.CoreInterfaces.SSESessionPageNumber.Field,
	func(s *schema.Session, i int) (any, error) {
		var currentPageNumber int64 = 0
		currentPageValue, ok := s.Events[0].Values[columns.CoreInterfaces.EventPageLocation.Field.Name].(string)
		if !ok {
			return nil, errors.New("invalid page location type")
		}
		currentPage := currentPageValue
		for idx := 0; idx <= i; idx++ {
			candidatePageValue, ok := s.Events[idx].Values[columns.CoreInterfaces.EventPageLocation.Field.Name].(string)
			if !ok {
				return nil, errors.New("invalid page location type")
			}
			if currentPage != candidatePageValue {
				currentPageNumber++
				currentPage = candidatePageValue
			}
			if idx == i {
				return currentPageNumber, nil
			}
		}
		return nil, errors.New("event not found in session")
	},
	columns.WithSessionScopedEventColumnRequired(false),
	columns.WithSessionScopedEventColumnDependsOn(
		schema.DependsOnEntry{
			Interface:        columns.CoreInterfaces.EventPageLocation.ID,
			GreaterOrEqualTo: columns.CoreInterfaces.EventPageLocation.Version,
		},
	),
	columns.WithSessionScopedEventColumnDocs(
		"Session Page Number",
		"The sequential page number within the session, starting from 0. Increments when the page location changes. Tracks which page view in the session this event occurred on.",
	),
)

SSESessionPageNumber is a session-scoped event column that tells of which page counting from beginning of the session the event is on

View Source
var UserIDColumn = columns.NewSimpleEventColumn(
	columns.CoreInterfaces.EventUserID.ID,
	columns.CoreInterfaces.EventUserID.Field,
	func(event *schema.Event) (any, error) {
		if event.BoundHit.UserID == nil {
			return nil, nil
		}
		return *event.BoundHit.UserID, nil
	},
	columns.WithEventColumnDocs(
		"User ID",
		"An optional, user-provided identifier for authenticated users. It is set by the tracking implementation when a user is logged in (and can be identified) and enables tracking across devices and sessions for the same user.",
	),
)

UserIDColumn is the column for the user ID of an event

View Source
var UtmCampaignColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventUtmCampaign.ID,
	columns.CoreInterfaces.EventUtmCampaign.Field,
	"utm_campaign",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventUtmCampaign.ID)),
	),
	columns.WithEventColumnDocs(
		"UTM Campaign",
		"The campaign name from the 'utm_campaign' URL parameter, used to identify specific marketing campaigns (e.g., 'summer_sale', 'product_launch_2024').",
	),
)

UtmCampaignColumn is the column for the UTM campaign of an event

View Source
var UtmContentColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventUtmContent.ID,
	columns.CoreInterfaces.EventUtmContent.Field,
	"utm_content",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventUtmContent.ID)),
	),
	columns.WithEventColumnDocs(
		"UTM Content",
		"The content identifier from the 'utm_content' URL parameter, used to differentiate similar content or links within the same campaign (e.g., 'banner_top', 'button_cta').",
	),
)

UtmContentColumn is the column for the UTM content of an event

View Source
var UtmCreativeFormatColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventUtmCreativeFormat.ID,
	columns.CoreInterfaces.EventUtmCreativeFormat.Field,
	"utm_creative_format",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventUtmCreativeFormat.ID)),
	),
	columns.WithEventColumnDocs(
		"UTM Creative Format",
		"The creative format from the 'utm_creative_format' URL parameter, identifies the format of the creative asset.",
	),
)

UtmCreativeFormatColumn is the column for the UTM creative format of an event

View Source
var UtmIDColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventUtmID.ID,
	columns.CoreInterfaces.EventUtmID.Field,
	"utm_id",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventUtmID.ID)),
	),
	columns.WithEventColumnDocs(
		"UTM ID",
		"The campaign ID from the 'utm_id' URL parameter, used to identify a specific campaign with a unique identifier for integration with advertising platforms.",
	),
)

UtmIDColumn is the column for the UTM ID of an event

View Source
var UtmMarketingTacticColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventUtmMarketingTactic.ID,
	columns.CoreInterfaces.EventUtmMarketingTactic.Field,
	"utm_marketing_tactic",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventUtmMarketingTactic.ID)),
	),
	columns.WithEventColumnDocs(
		"UTM Marketing Tactic",
		"The marketing tactic from the 'utm_marketing_tactic' URL parameter, describes the targeting criteria (e.g., 'remarketing', 'prospecting').",
	),
)

UtmMarketingTacticColumn is the column for the UTM marketing tactic of an event

View Source
var UtmMediumColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventUtmMedium.ID,
	columns.CoreInterfaces.EventUtmMedium.Field,
	"utm_medium",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventUtmMedium.ID)),
	),
	columns.WithEventColumnDocs(
		"UTM Medium",
		"The traffic medium from the 'utm_medium' URL parameter, identifies the marketing medium (e.g., 'cpc', 'email', 'social', 'organic').",
	),
)

UtmMediumColumn is the column for the UTM medium of an event

View Source
var UtmSourceColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventUtmSource.ID,
	columns.CoreInterfaces.EventUtmSource.Field,
	"utm_source",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventUtmSource.ID)),
	),
	columns.WithEventColumnDocs(
		"UTM Source",
		"The traffic source from the 'utm_source' URL parameter, identifies where the traffic originated (e.g., 'google', 'facebook', 'newsletter').",
	),
)

UtmSourceColumn is the column for the UTM source of an event

View Source
var UtmSourcePlatformColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventUtmSourcePlatform.ID,
	columns.CoreInterfaces.EventUtmSourcePlatform.Field,
	"utm_source_platform",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventUtmSourcePlatform.ID)),
	),
	columns.WithEventColumnDocs(
		"UTM Source Platform",
		"The source platform from the 'utm_source_platform' URL parameter, identifies the platform of the traffic source (e.g., 'Google Ads', 'Display & Video 360', 'Meta Ads').",
	),
)

UtmSourcePlatformColumn is the column for the UTM source platform of an event

View Source
var UtmTermColumn = columns.FromPageURLParamEventColumn(
	columns.CoreInterfaces.EventUtmTerm.ID,
	columns.CoreInterfaces.EventUtmTerm.Field,
	"utm_term",
	true,
	columns.WithEventColumnCast(
		columns.StrNilIfErrorOrEmpty(columns.CastToString(columns.CoreInterfaces.EventUtmTerm.ID)),
	),
	columns.WithEventColumnDocs(
		"UTM Term",
		"The search term from the 'utm_term' URL parameter, used primarily for paid search campaigns to identify the keywords that triggered the ad.",
	),
)

UtmTermColumn is the column for the UTM term of an event

Functions

func PropertyNameColumn added in v0.10.0

func PropertyNameColumn(psr properties.SettingsRegistry) schema.EventColumn

PropertyNameColumn is the column for the name of the property of an event

Types

This section is empty.

Jump to

Keyboard shortcuts

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