private async Task RecordUserVisit(string path, string visitorSessionId) { // Don't record asset file loads; they're just noise. var isFile = Regex.IsMatch(path, "\\.[^/]+$"); if (isFile) { return; } // We're interested only in humans who came to learn about us or sign up. if (!IsPerson()) { return; } // Record the visit. Account account = null; if (User.Identity.IsAuthenticated) { var auth0UserId = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value; account = new Account { Auth0UserId = auth0UserId }; } await _userEventsService.RecordEvent(new UserEvent { Account = account, SessionId = visitorSessionId, Category = "page", Name = "load", Value = path }); }