private void asyncTrackGoogleEvents(string Category, string Action, string Label) { GoogleEvent GoogleEvent = new GoogleEvent("MadeToEarn.com", Category, Action, Label, 1); TrackingRequest requestEvent = new RequestFactory().BuildRequest(GoogleEvent); GoogleTracking.FireTrackingEvent(requestEvent); }
private static void TrackEvent(string location, string variable, string startDate, string endDate, int?count, HttpContext httpContext) { try { GoogleEvent googleEvent = new GoogleEvent("river.sdsc.edu", "NWISUV", "GetValuesObject", String.Format("{0}|{1}|{2}|{3}", location, variable, startDate, endDate), count ); TrackingRequest request = new RequestFactory().BuildRequest(googleEvent, httpContext); request.RequestedByIpAddress = httpContext.Request.UserHostAddress; GoogleTracking.FireTrackingEvent(request); } catch { return; } }
private void SendData(object sender, RoutedEventArgs e) { List <RadioButton> buttons = myGrid.Children.OfType <RadioButton>().ToList(); GoogleEvent googleevent; foreach (RadioButton butt in buttons) { if ((bool)butt.IsChecked) { if (butt.Tag.ToString().Equals("Yes")) { googleevent = new GoogleEvent("SocialSilence", butt.GroupName, (string)butt.Tag, (string)butt.Tag, 1); } else if (butt.Tag.ToString().Equals("No")) { googleevent = new GoogleEvent("SocialSilence", butt.GroupName, (string)butt.Tag, (string)butt.Tag, -1); } else { googleevent = new GoogleEvent("SocialSilence", butt.GroupName, (string)butt.Tag, (string)butt.Tag, 0); } TrackingRequest request = new RequestFactory().BuildRequest(googleevent); GoogleTracking.FireTrackingEvent(request); } } this.Close(); }
/// <summary> /// Track the download event /// </summary> /// <param name="path"></param> /// <param name="context"></param> /// <param name="bytes"></param> private static void TrackDownloadEvent(string path, HttpContextWrapper context, long bytes) { ConfigurationManager.AppSettings["GoogleAnalyticsAccountCode"] = SettingsHelper.GetGoogleAnalyticsProfile(); var code = GaDotNet.Common.Data.ConfigurationSettings.GoogleAccountCode; string referrer = "NoReferrer"; if (context.Request != null && context.Request.UrlReferrer != null) { referrer = context.Request.UrlReferrer.Host; } int kiloBytes = (int)(bytes / 1024); GoogleEvent googleEvent = new GoogleEvent("http://localhost.local", "Download", referrer, path, kiloBytes); var app = (HttpApplication)context.GetService(typeof(HttpApplication)); TrackingRequest request = new RequestFactory().BuildRequest(googleEvent, app.Context); GoogleTracking.FireTrackingEvent(request); }
private static void TrackEvent(string location, string variable, string startDate, string endDate, int?count, HttpContext httpContext, string ServiceName, string MethodName) { try { GoogleEvent googleEvent = new GoogleEvent("river.sdsc.edu", ServiceName, MethodName, String.Format("{0}|{1}|{2}|{3}", location, variable, startDate, endDate), count ); TrackingRequest request = new RequestFactory().BuildRequest(googleEvent, httpContext); request.RequestedByIpAddress = httpContext.Request.UserHostAddress; GoogleTracking.FireTrackingEvent(request); } catch { log.Error("GoogleTracker Failed"); } }
public void AsyncTrackGoogleEvents(string category, string action, string label) { var googleEvent = new GoogleEvent("MadeToEarn.com", category, action, label, 1); var requestEvent = new RequestFactory().BuildRequest(googleEvent); GoogleTracking.FireTrackingEvent(requestEvent); }
protected void btnPageSubmit_Click(object sender, EventArgs e) { GooglePageView pageView = new GooglePageView(txtPageTitle.Text, txtPageDomainName.Text, txtPageURL.Text); TrackingRequest request = new RequestFactory().BuildRequest(pageView); GoogleTracking.FireTrackingEvent(request); divAction.InnerText = "Page view successfully tracked"; divAction.Visible = true; }
public static void TrackPlay() { try { GooglePageView pageView = new GooglePageView("youtube.fm", "youtube.fm", "/play.html"); TrackingRequest request = new RequestFactory().BuildRequest(pageView); request.AnalyticsAccountCode = "UA-29014752-2"; GoogleTracking.FireTrackingEvent(request); } catch (Exception exception) { Log.Error(exception); } }
public void Notify(string action, string label, int?value) { try { var googleEvent = new GoogleEvent(Constants.BaseAnalyticsDomainName, Constants.GaCategory, action, label, value); _log.Debug("Building event " + googleEvent); var request = _requestFactory.BuildRequest(googleEvent); _log.Debug("Firing event " + googleEvent); GoogleTracking.FireTrackingEvent(request); _log.Debug("Event " + googleEvent + " Fired"); } catch (Exception e) { _log.ErrorException("Error while trying to perform analytics event", e); } }