Exemplo n.º 1
0
        private VisitizeReducer()
        {
            DateTime dt = DateTime.Parse(@"2016-09-02 06:00:00").AddMinutes(60);

            endOfDelta = dt.Ticks;
            sessionTimeoutThreshold = VisitizationUtils.GetTickesFromMinutes(sessionTimeoutThreshold.ToString());
        }
Exemplo n.º 2
0
        private static SAEventConversionFacts BuildVisitEventGroupFromEventsList(long sessionTimeoutThreshold, long endOfDelta, List <UETEvent> uetEvents, int maxEventsPerVisit, int maxVisitsPerIPTag)
        {
            var factObject = new SAEventConversionFacts {
                Visits = new List <Visit>()
            };

            long   prevDateTime = 0;
            string prevReferrer = string.Empty;

            foreach (var uetEvent in uetEvents)
            {
                if (!VisitizationUtils.AreEventGroupsInTheSameVisit(uetEvent, prevDateTime, prevReferrer, sessionTimeoutThreshold))
                {
                    // Not the same group, Create a new Visit and add this event to be the first one.

                    if (factObject.Visits.Count == maxVisitsPerIPTag)
                    {
                        // Visits within the IPTag already reach the limit, we should break and stop adding new Visits.
                        break;
                    }

                    // Create a new Visit and add it to the Visits list
                    var visitId = VisitizationUtils.GenerateVisitId(
                        uetEvent.ANID == null ? null : (Guid?)uetEvent.ANID.ToSystemGuid(),
                        uetEvent.MUID == null ? null : (Guid?)uetEvent.MUID.ToSystemGuid(),
                        uetEvent.EventDateTime,
                        uetEvent.ReferrerURL);

                    var newVisit = InitializeNewVisit(visitId, uetEvent.EventDateTime, sessionTimeoutThreshold, endOfDelta);
                    newVisit.Events.Add(uetEvent);
                    factObject.Visits.Add(newVisit);
                }
                else
                {
                    // Add the event to the last Visit in the Visits list
                    var lastVisit = factObject.Visits[factObject.Visits.Count - 1];
                    if (lastVisit.Events.Count < maxEventsPerVisit)
                    {
                        lastVisit.Events.Add(uetEvent);
                    }
                }

                prevDateTime = uetEvent.EventDateTime;
                prevReferrer = uetEvent.ReferrerURL;
            }

            return(factObject);
        }
Exemplo n.º 3
0
        public string GetData(string line)
        {
            if (string.IsNullOrEmpty(line))
            {
                return(null);
            }
            else
            {
                AppInstallVisitsSchema output = new AppInstallVisitsSchema();
                UETLogView             data   = UETLogView.Deserialize(line);
                output.AppInstallClickId = data.AppInstallClickId;

                var eventDataTime = data.EventDateTime;
                var anid          = data.ANID;
                var muid          = data.MUID;
                var referrerUrl   = data.ReferrerURL;

                var visit = new Visit();
                visit.VisitId = VisitizationUtils.GenerateVisitId(anid, muid, eventDataTime, referrerUrl);

                var uetEvent = new UETEvent();
                uetEvent.EventDateTime    = eventDataTime;
                uetEvent.ANID             = anid == null ? null : new GUID(anid.Value);
                uetEvent.MUID             = muid == null ? null : new GUID(muid.Value);
                uetEvent.ReferrerURL      = referrerUrl;
                uetEvent.PageTitle        = data.PageTitle;
                uetEvent.NavigatedFromURL = data.NavigatedFromURL;
                uetEvent.GoalValue        = data.GoalValue;
                uetEvent.PageLoad         = data.PageLoad;
                uetEvent.Version          = data.Version;
                uetEvent.LogServerName    = data.LogServerName;
                uetEvent.EventType        = data.EventType;

                visit.Events = new List <UETEvent> {
                    uetEvent
                };

                visit.Statistic = new VisitStatistic {
                    VisitStartDateTime = eventDataTime
                };
                output.Visit = visit;
                return(AppInstallVisitsSchema.Serialize(output));
            }
        }