public static async Task <bool> SendAsync(ITracker tracker, string socialNetwork, string socialAction, string socialActionTarget) { var hit = new SocialHit(socialNetwork, socialAction, socialActionTarget) { DataSource = "app" }; // create the hit request. var request = (HitRequestBase)tracker.CreateHitRequest(hit); // Run a debug check to ensure its valid. var debugResponse = await request.ExecuteDebugAsync(); if (!((DebugResult)debugResponse).IsValid()) { return(false); } // Send hit. var collectRequest = await request.ExecuteCollectAsync(); Console.Write(collectRequest.RawResponse); return(true); }
public static async Task <bool> SendAsync(ITracker tracker, string userTimeingCatagory, string userTimeingVariableName, int userTimingTime) { var hit = new TimingHit(userTimeingCatagory, userTimeingVariableName, userTimingTime) { DataSource = "app" }; // create the hit request. var request = (HitRequestBase)tracker.CreateHitRequest(hit); // Run a debug check to ensure its valid. var debugResponse = await request.ExecuteDebugAsync(); if (!((DebugResult)debugResponse).IsValid()) { return(false); } // Send hit. var collectRequest = await request.ExecuteCollectAsync(); Console.Write(collectRequest.RawResponse); return(true); }
public static async Task <bool> SendAsync(ITracker tracker, string screenName) { var hit = new ScreenViewHit(screenName) { DataSource = "app", UserAgentOverride = @"Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19" }; // create the hit request. var request = (HitRequestBase)tracker.CreateHitRequest(hit); // Run a debug check to ensure its valid. var debugResponse = await request.ExecuteDebugAsync(); if (!((DebugResult)debugResponse).IsValid()) { return(false); } // Send hit. var collectRequest = await request.ExecuteCollectAsync(); Console.Write(collectRequest.RawResponse); return(true); }
public static bool Send(ITracker tracker) { var hit = new EventHit("Events", "Click", "Awsom", 1) { UserId = "123456", DataSource = "app", GeographicalOverride = "US", IpOverride = "1.1.1.1", UserAgentOverride = "Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14", ScreenResolution = "100x100", ViewportSize = "50x50", DocumentEncoding = "UTF-8", ScreenColors = "24-bits", // System info UserLanguage = "de-CH", JavaEnabled = "1", FlashVersion = "10 1 r103" }; var request = (HitRequestBase)tracker.CreateHitRequest(hit); var debugResponse = Task.Run(() => request.ExecuteDebugAsync()); debugResponse.Wait(); Console.Write(debugResponse.Result.RawResponse); var response = (DebugResult)debugResponse.Result; if (!response.Response.hitParsingResult.FirstOrDefault().valid) { return(false); } Console.Write(response.Response.hitParsingResult.FirstOrDefault().valid); var collectRequest = Task.Run(() => request.ExecuteCollectAsync()); collectRequest.Wait(); Console.Write(collectRequest.Result.RawResponse); return(true); }