/// <summary> /// Validates current event (and existing payload data) and puts the result in a container object /// </summary> /// <param name="analyticsEvent">Events to track</param> /// <returns>The result of the hit validation operation</returns> public TrackingResult ValidateHit(IUniversalAnalyticsEvent analyticsEvent) { var result = new TrackingResult(); try { string postData = this._postDataBuilder.BuildPostDataString(MEASUREMENT_PROTOCOL_VERSION, analyticsEvent, _customPayload); result.ValidationResult = _googleDataSender.SendData(GOOGLE_COLLECTION_URI_DEBUG, postData, /*bReadResponse*/ true); } catch (Exception e) { result.Exception = e; } return(result); }
/// <summary> /// Pushes an event up to the Universal Analytics web property specified in the .config file. /// </summary> /// <param name="analyticsEvent">The event to be logged.</param> public void TrackEvent(IUniversalAnalyticsEvent analyticsEvent) { string postData = postDataBuilder.BuildPostDataString(MEASUREMENT_PROTOCOL_VERSION, analyticsEvent); googleDataSender.SendData(GOOGLE_COLLECTION_URI, postData); }