public override void TrackEvent(string category, string action, string label = null) { var context = Application.Context; if (context == null) { return; } var eventBuilder = new HitBuilders.EventBuilder(); eventBuilder.SetCategory(category) .SetAction(action); if (label != null) { eventBuilder.SetLabel(label); } foreach (var key in CustomDimensions.Keys) { eventBuilder.SetCustomDimension(key, CustomDimensions[key]); } Tracker.Send(eventBuilder.Build()); }
public void TrackEvent( EventData eventData, List <CustomDimension> customDimensions, List <CustomMetric> customMetrics ) { var builder = new HitBuilders.EventBuilder() .SetCategory(eventData.EventCategory) .SetAction(eventData.EventAction); if (!string.IsNullOrWhiteSpace(eventData?.EventLabel)) { builder.SetLabel(eventData.EventLabel); } if (!string.IsNullOrWhiteSpace(eventData?.EventLabel)) { builder.SetValue(eventData.Id); } if (customDimensions?.Count > 0) { foreach (var customDimension in customDimensions) { builder.SetCustomDimension(customDimension.DimensionIndex, customDimension.DimensionValue); } } if (customMetrics?.Count > 0) { foreach (var customMetric in customMetrics) { builder.SetCustomMetric(customMetric.MetricIndex, customMetric.MetricValue); } } analyticsTracker.Send(builder.Build()); }