Acquisition-change boundary rule for sessionization.
A session is split when the normalized acquisition tuple
{source_platform, source_medium, source_campaign, click_id} meaningfully
differs from the live session and the new event's acquisition is not direct.
Only acquisition signals are compared; raw referrer changes do not split a
session.
When a live session is direct and a later event carries a real acquisition signal, the session source is updated in place instead of splitting.
Summary
Types
Continue the live session, start a new one, or update the live source in place.
Functions
Decides how a new event's acquisition attrs affect a live session.
True when attrs carry no real acquisition signal.
Extracts normalized acquisition attrs for a session and drops all other keys.
Types
@type acquisition_attrs() :: %{ source_platform: String.t() | nil, source_medium: String.t() | nil, source_campaign: String.t() | nil, click_id: Ecto.UUID.t() | nil }
@type decision() :: :continue | :new_session | :update_source
Continue the live session, start a new one, or update the live source in place.
Functions
@spec decision(GoodAnalytics.Core.Sessions.Session.t(), map()) :: decision()
Decides how a new event's acquisition attrs affect a live session.
True when attrs carry no real acquisition signal.
@spec to_session_acquisition(map()) :: acquisition_attrs()
Extracts normalized acquisition attrs for a session and drops all other keys.