Skip to content

[FEATURE] Expose FeatureClient Track method in IFeatureClient interface #518

@kylejuliandev

Description

@kylejuliandev

Requirements

#327 introduced a method for tracking user interactions

/// <summary>
/// Use this method to track user interactions and the application state.
/// </summary>
/// <param name="trackingEventName">The name associated with this tracking event</param>
/// <param name="evaluationContext">The evaluation context used in the evaluation of the flag (optional)</param>
/// <param name="trackingEventDetails">Data pertinent to the tracking event (Optional)</param>
/// <exception cref="ArgumentException">When trackingEventName is null or empty</exception>
public void Track(string trackingEventName, EvaluationContext? evaluationContext = default, TrackingEventDetails? trackingEventDetails = default)
{
if (string.IsNullOrWhiteSpace(trackingEventName))
{
throw new ArgumentException("Tracking event cannot be null or empty.", nameof(trackingEventName));
}
var globalContext = Api.Instance.GetContext();
var clientContext = this.GetContext();
var evaluationContextBuilder = EvaluationContext.Builder()
.Merge(globalContext)
.Merge(clientContext);
if (evaluationContext != null) evaluationContextBuilder.Merge(evaluationContext);
this._providerAccessor.Invoke().Track(trackingEventName, evaluationContextBuilder.Build(), trackingEventDetails);
}

This method is not currently available on the IFeatureClient abstraction. This means developers or consumers who depend on this abstraction cannot use this method. While Tracking is still experimental, it would be good to ensure we appropriately expose this API.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions