Skip to main content

AnalyticsEvent

An abstract class in Alta.Analytics.Runtime, Alta.Analytics.

Base class for analytics events in the current system. Holds the event data and lets instruments add extra properties once VContainer injects the event.

Constructors​

MemberWhat it is
protected AnalyticsEvent(string eventName, int? userId = null)Creates an AnalyticsEvent from eventName and userId.

Fields​

4 private and internal fields
MemberWhat it is
private List<IAnalyticsInstrument> cachedInstrumentsInstruments waiting for the event to be injected.
private readonly IAnalyticsData dataThe event's AnalyticsData.
private Queue<IAnalyticsInstrument> instrumentsUnused instrument queue.
private IObjectResolver resolverVContainer resolver, set by Inject.

Properties​

MemberWhat it is
IReadonlyAnalyticsData Data { get; }The event's data, read only.
virtual string EventName { get; }The event's name, set by the constructor.
int? UserId { get; }The user ID from the data, or null.

Methods​

MemberWhat it is
void AddInstrument(IAnalyticsInstrument instrument)Adds an instrument that appends its result to the data. Waits until injection if the event has not been injected yet.
void AddProperty(string propertyName, object value)Adds a property to the event's data.
void Inject(IObjectResolver resolver)Called by VContainer (from AnalyticsService.Send). Stores the resolver and runs any waiting instruments.
1 private and internal method
MemberWhat it is
private void InjectCachedInstruments()Injects and runs instruments added before the event was injected, then clears them.