public override Task SendHit(HitAbstract hit) { return(Task.Factory.StartNew(() => { Log("SendHit"); })); }
protected HitAbstract GetHitFromContent(JObject content) { HitAbstract hit = null; switch (content["Type"].ToObject <HitType>()) { case HitType.EVENT: hit = content.ToObject <Event>(); break; case HitType.ITEM: hit = content.ToObject <Item>(); break; case HitType.PAGEVIEW: hit = content.ToObject <Page>(); break; case HitType.SCREENVIEW: hit = content.ToObject <Screen>(); break; case HitType.TRANSACTION: hit = content.ToObject <Transaction>(); break; } return(hit); }
public override async Task SendHit(HitAbstract hit) { const string functionName = "SendHit"; try { if (hit == null) { Log.LogError(Config, Constants.HIT_NOT_NULL, functionName); return; } hit.VisitorId = Visitor.VisitorId; hit.DS = Constants.SDK_APP; hit.Config = Config; hit.AnonymousId = Visitor.AnonymousId; if (!hit.IsReady()) { Log.LogError(Config, hit.GetErrorMessage(), functionName); return; } await TrackingManager.SendHit(hit); } catch (Exception ex) { Visitor.GetStrategy().CacheHit(hit); Log.LogError(Config, ex.Message, functionName); } }
public async Task SendHit(HitAbstract hit) { var requestMessage = new HttpRequestMessage(HttpMethod.Post, Constants.HIT_API_URL); var postDatajson = JsonConvert.SerializeObject(hit.ToApiKeys()); var stringContent = new StringContent(postDatajson, Encoding.UTF8, Constants.HEADER_APPLICATION_JSON); requestMessage.Content = stringContent; await HttpClient.SendAsync(requestMessage); }
public virtual async void CacheHit(HitAbstract hit) { try { var hitCacheInstance = Config?.HitCacheImplementation; if (hitCacheInstance == null || Config.DisableCache) { return; } var hitDataString = BuildHitCacheData(hit, (HitCacheType)hit.Type); await hitCacheInstance.CacheHit(Visitor.VisitorId, hitDataString); } catch (Exception ex) { Logger.Log.LogError(Config, ex.Message, "CacheHit"); } }
public override void CacheHit(HitAbstract hit) { // }
public override Task SendHit(HitAbstract hit) { return(GetStrategy().SendHit(hit)); }
abstract public Task SendHit(HitAbstract hit);