Exemplo n.º 1
0
 public virtual async Task <TrackingResult> OnTrackingAction(ActionExecutingContext filterContext)
 {
     return(await Tracker.TrackPageViewAsync(
                filterContext.RequestContext.HttpContext,
                BuildCurrentActionName(filterContext),
                BuildCurrentActionUrl(filterContext)));
 }
Exemplo n.º 2
0
        public static async Task <TrackingResult> TrackPageViewAsync(this Tracker tracker, HttpContextBase httpContext, string pageTitle, string pageUrl = null)
        {
            var pageViewParameters = new PageView
            {
                DocumentTitle                                    = pageTitle,
                DocumentLocationUrl                              = pageUrl,
                UserAgent                                        = httpContext.Request.UserAgent,
                DocumentHostName                                 = httpContext.Request.UserHostName,
                UserLanguage                                     = httpContext.Request.UserLanguages != null?string.Join(";", httpContext.Request.UserLanguages).ToLower() : null,
                                                     ReferralUrl = httpContext.Request.UrlReferrer != null?httpContext.Request.UrlReferrer.ToString() : null,
                                                                       CacheBuster = tracker.AnalyticsSession.GenerateCacheBuster()
            };

            return(await tracker.TrackPageViewAsync(pageViewParameters));
        }