public override void OnActionExecuting(HttpActionContext actionContext)
        {
            if (!String.IsNullOrEmpty(analyticsId))
            {
                string baseUrl = actionContext.ControllerContext.GetWorkContext().CurrentSite.BaseUrl;

                using (var tracker = new Tracker(analyticsId, baseUrl))
                {
                    tracker.TrackPageViewAsync(actionContext.Request, _title);
                }
            }
        }
        public ActionTrackingAttribute(string trackingAccount, string trackingDomain, string actionDescription, string actionUrl)
        {
            try
            {
                if (string.IsNullOrEmpty(trackingDomain) && System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.Request != null)
                {
                    trackingDomain = System.Web.HttpContext.Current.Request.Url.Host;
                }
            }
            catch
            {
                // intended
            }

            Tracker = new Tracker(trackingAccount, trackingDomain, new CookieBasedAnalyticsSession(), new AspNetWebApiTrackerEnvironment());
            ActionDescription = actionDescription;
            ActionUrl = actionUrl;
        }
 public ActionTrackingAttribute(string trackingAccount, string trackingDomain, Func<HttpActionContext, bool> isTrackableAction)
 {
     Tracker = new Tracker(trackingAccount, trackingDomain, new CookieBasedAnalyticsSession(), new AspNetWebApiTrackerEnvironment());
     IsTrackableAction = isTrackableAction;
 }
 public ActionTrackingAttribute(Tracker tracker, Func<HttpActionContext, bool> isTrackableAction)
 {
     Tracker = tracker;
     IsTrackableAction = isTrackableAction;
 }
 public ActionTrackingAttribute(Tracker tracker)
     : this(tracker, action => true)
 {
 }
		public static void RegisterTracker(this HttpConfiguration configuration, Tracker tracker)
        {
			configuration.Filters.Add(new ActionTrackingAttribute(tracker));
		}
 public static async Task <TrackingResult> TrackPageViewAsync(this Tracker tracker, HttpRequestMessage httpRequest, string pageTitle)
 {
     return(await TrackPageViewAsync(tracker, httpRequest, pageTitle, httpRequest.RequestUri.PathAndQuery));
 }