public static async Task<TrackingResult> TrackEventAsync(this SimpleTracker tracker, string category, string action, string label, long value = 1)
        {
            var eventTrackingParameters = new EventTracking
            {
                Category = category,
                Action = action,
                Label = label,
                Value = value,
                CacheBuster = tracker.AnalyticsSession.GenerateCacheBuster()
            };

            return await tracker.TrackAsync(eventTrackingParameters);
        }
        public async Task TrackEventAsync(Exception ex)
        {
            var eventTrackingParameters = new EventTracking
            {
                Category = "Errors",
                Action = ex.Message,
                Label = GetRelativeUrl(),
                Value = ex.HResult,
                DocumentHostName = _context.Request.Uri.Host,
                UserAgent = _context.Request.Headers["User-Agent"],
                UserLanguage = _context.Request.Headers["Accept-Language"],
                DocumentReferrer = _context.Request.Headers["Referrer"],
                IpOverride = _context.Request.Environment["server.RemoteIpAddress"] != null ? _context.Request.Environment["server.RemoteIpAddress"].ToString() : null,
                UserId = _context.Authentication.User.Identity.Name
            };

            await TrackAsync(eventTrackingParameters);
        }
Esempio n. 3
0
 public static void TrackEventAsync(string category, string action, string label, int value = 1)
 {
     if (!IsEnabled)
     {
         return;
     }
     var pageView = new EventTracking
         {
             Category = category,
             Action = action,
             Label = label,
             Value = value
         };
     FillParameters(pageView);
     instance.TrackEventAsync(pageView);
 }