public ITrackGoalRequest FillTrackGoalGaps(ITrackGoalRequest userRequest)
        {
            var utGoal = userRequest.Goal.DeepCopyUTGoal();

            //order matters!
            IUTSessionConfig mergedSessionConfig = this.SessionConfigMerger.FillSessionConfigGaps(userRequest.SessionConfig);

            var utEvent = this.ApplyActiveInteraction(utGoal, mergedSessionConfig);

            utEvent = this.ApplyDeviceIdentifier(utEvent);

            utGoal = new UTGoal(utEvent);

            return(new TrackGoalParameters(mergedSessionConfig, utGoal));
        }
示例#2
0
        public async Task <UTResponse> TrackGoalAsync(ITrackGoalRequest request, CancellationToken cancelToken = default(CancellationToken))
        {
            BaseValidator.CheckNullAndThrow(request, this.GetType().Name + ".GoalRequest");

            ITrackGoalRequest requestCopy = request.DeepCopyTrackGoalRequest();

            ITrackGoalRequest autocompletedRequest = this.requestMerger.FillTrackGoalGaps(requestCopy);


            //FIXME: @igk
            if (this.InteractionNotExists())
            {
                return(await this.CreateInteractionAndSentEventAsync(request.Goal, cancelToken));
            }

            var urlBuilder = new TrackEventUrlBuilder <ITrackGoalRequest>(this.utGrammar);
            var taskFlow   = new TrackGoalTask(urlBuilder, this.httpClient);

            var response = await RestApiCallFlow.LoadRequestFromNetworkFlow(autocompletedRequest, taskFlow, cancelToken);

            this.CheckResponseForValidInteraction(response);

            return(response);
        }