public async ValueTask <RedirectResult> Index(string identifier, [FromQuery] string site, [FromQuery] string eventCategory, [FromQuery] string eventAction, [FromQuery] string eventLabel, CancellationToken token) { var query = new ShortUrlQuery(identifier); var result = await _queryBus.QueryAsync(query, token); if (result == null) { return(Redirect("/")); } if (eventCategory != null && eventAction != null && eventLabel != null) { await _googleAnalytics.TrackEventAsync(eventCategory, eventAction, eventLabel, token); } if (!Uri.TryCreate(result.Destination, UriKind.RelativeOrAbsolute, out var uri)) { return(RedirectPermanent(result.Destination)); } if (uri.IsAbsoluteUri) { return(RedirectPermanent(result.Destination)); } var destination = result.Destination; if (site?.Equals("frymo", StringComparison.OrdinalIgnoreCase) == true) { if (destination.Contains("?")) { destination += "&site=frymo"; } else { destination += "?site=frymo"; } } return(RedirectPermanent(destination)); }
public Task HandleAsync(TutorApprovedEvent eventMessage, CancellationToken token) { return(_googleAnalytics.TrackEventAsync("Tutor funnel", "Tutor approved", eventMessage.UserId.ToString(), token)); }