예제 #1
0
        public async Task <UTResponse> CreateInteractionAndSentEventAsync(IUTEvent utEvent, CancellationToken cancelToken = default(CancellationToken))
        {
            UTResponse interactionResponse = null;


            Collection <IUTEvent> events = new Collection <IUTEvent>();

            events.Add(utEvent);

            var interaction = new UTInteraction
                              (
                this.defaultInteraction.CampaignId,
                this.defaultInteraction.ChannelId,
                events,
                this.defaultInteraction.Initiator,
                this.defaultInteraction.UserAgent,
                this.defaultInteraction.VenueId,
                this.defaultInteraction.Contact
                              );

            var interactionRequest = new TrackInteractionParameters(null, interaction);

            interactionResponse = await this.TrackInteractionAsync(interactionRequest, cancelToken);

            return(interactionResponse);
        }
        public ITrackEventRequest FillTrackEventGaps(ITrackEventRequest userRequest)
        {
            IUTEvent utEvent = userRequest.Event.DeepCopyUTEvent();

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

            utEvent = this.ApplyActiveInteraction(utEvent, mergedSessionConfig);
            utEvent = this.ApplyDeviceIdentifier(utEvent);

            return(new TrackEventParameters(mergedSessionConfig, utEvent));
        }
예제 #3
0
 public UTGoal(IUTEvent uTEvent) : base(
         uTEvent.Timestamp,
         uTEvent.CustomValues,
         uTEvent.DefinitionId,
         uTEvent.ItemId,
         uTEvent.EngagementValue,
         uTEvent.ParentEventId,
         uTEvent.Text,
         uTEvent.Duration,
         uTEvent.TrackingInteractionId,
         "goal"
         )
 {
 }
예제 #4
0
        public IInteractionParametersBuilder <T> AddEvents(IUTEvent utEvent)
        {
            BaseValidator.CheckNullAndThrow(utEvent, this.GetType().Name + ".utEvent");

            bool isDuplicated = DuplicateEntryValidator.IsObjectInTheList(this.EventsAggregator, utEvent);

            if (isDuplicated)
            {
                throw new InvalidOperationException(this.GetType().Name + ".utEvent : duplicate Events are not allowed");
            }

            this.EventsAggregator.Add(utEvent);

            return(this);
        }
 public UTCampaign(IUTEvent utEvent, string campaignDefinitionId)
     : base(
         utEvent.Timestamp,
         utEvent.CustomValues,
         utEvent.DefinitionId,
         utEvent.ItemId,
         utEvent.EngagementValue,
         utEvent.ParentEventId,
         utEvent.Text,
         utEvent.Duration,
         utEvent.TrackingInteractionId,
         "campaign"
         )
 {
     this.CampaignDefinitionId = campaignDefinitionId;
 }
예제 #6
0
 public UTSearch(IUTEvent utEvent, string keywords)
     : base(
         utEvent.Timestamp,
         utEvent.CustomValues,
         utEvent.DefinitionId,
         utEvent.ItemId,
         utEvent.EngagementValue,
         utEvent.ParentEventId,
         utEvent.Text,
         utEvent.Duration,
         utEvent.TrackingInteractionId,
         "search"
         )
 {
     this.Keywords = keywords;
 }
예제 #7
0
 public UTOutcome(IUTEvent utEvent, string currencyCode, decimal monetaryValue)
     : base(
         utEvent.Timestamp,
         utEvent.CustomValues,
         utEvent.DefinitionId,
         utEvent.ItemId,
         utEvent.EngagementValue,
         utEvent.ParentEventId,
         utEvent.Text,
         utEvent.Duration,
         utEvent.TrackingInteractionId,
         "outcome"
         )
 {
     this.CurrencyCode  = currencyCode;
     this.MonetaryValue = monetaryValue;
 }
        public virtual ITrackEventRequest DeepCopyTrackEventRequest()
        {
            IUTSessionConfig connection = null;
            IUTEvent         uTEvent    = null;

            if (null != this.SessionConfig)
            {
                connection = this.SessionConfig.SessionConfigShallowCopy();
            }

            if (null != this.Event)
            {
                uTEvent = this.Event;
            }

            return(new TrackEventParameters(connection, uTEvent));
        }
예제 #9
0
 public UTPageView(IUTEvent utEvent, string itemLanguage, int?itemVersion, string url, SitecoreDeviceData sitecoreRenderingDevice)
     : base(
         utEvent.Timestamp,
         utEvent.CustomValues,
         utEvent.DefinitionId,
         utEvent.ItemId,
         utEvent.EngagementValue,
         utEvent.ParentEventId,
         utEvent.Text,
         utEvent.Duration,
         utEvent.TrackingInteractionId,
         "pageview"
         )
 {
     this.ItemLanguage            = itemLanguage;
     this.ItemVersion             = itemVersion;
     this.Url                     = url;
     this.SitecoreRenderingDevice = sitecoreRenderingDevice;
 }
        private IUTEvent ApplyDeviceIdentifier(IUTEvent utEvent)
        {
            string deviceInfoKey   = UTGrammar.UTV1Grammar().DeviceIdentifierKeyValue;
            string deviceInfoValue = null;

            Dictionary <string, string> mergedCustomValues = utEvent.CustomValues;

            if (mergedCustomValues == null)
            {
                mergedCustomValues = new Dictionary <string, string>();
            }

            if (mergedCustomValues.ContainsKey(deviceInfoKey))
            {
                deviceInfoValue = mergedCustomValues[deviceInfoKey];
            }

            if (this.defaultDeviceIdentifier == null || deviceInfoValue != null)
            {
                return(utEvent);
            }

            mergedCustomValues.Add(deviceInfoKey, this.defaultDeviceIdentifier);

            IUTEvent mergedEvent = new UTEvent(
                utEvent.Timestamp,
                mergedCustomValues,
                utEvent.DefinitionId,
                utEvent.ItemId,
                utEvent.EngagementValue,
                utEvent.ParentEventId,
                utEvent.Text,
                utEvent.Duration,
                utEvent.TrackingInteractionId,
                utEvent.type
                );

            return(mergedEvent);
        }
        private IUTEvent ApplyActiveInteraction(IUTEvent utEvent, IUTSessionConfig sessionConfig)
        {
            if (utEvent.TrackingInteractionId != null || sessionConfig.ActiveInteractionId == null)
            {
                return(utEvent);
            }

            IUTEvent mergedEvent = new UTEvent(
                utEvent.Timestamp,
                utEvent.CustomValues,
                utEvent.DefinitionId,
                utEvent.ItemId,
                utEvent.EngagementValue,
                utEvent.ParentEventId,
                utEvent.Text,
                utEvent.Duration,
                sessionConfig.ActiveInteractionId,
                utEvent.type
                );

            return(mergedEvent);
        }
 public TrackEventParameters(IUTSessionConfig sessionConfig, IUTEvent uTEvent)
 {
     this.SessionConfig = sessionConfig;
     this.Event         = uTEvent;
 }
        public static IInteractionParametersBuilder <ITrackInteractionRequest> Interaction(IUTEvent utEvent)
        {
            var list = new Collection <IUTEvent>();

            list.Add(utEvent);

            return(UTRequestBuilder.Interaction(list));
        }