Exemplo n.º 1
0
        private static bool ShouldProcessNonUsa()
        {
            if (!AnalyticsConfigurationHelper.OnlyUsa())
            {
                return(true);
            }

            return(Tracker.Current.Session.Interaction.GeoData.Country == "United States" ||
                   Tracker.Current.Session.Interaction.GeoData.Country == "US");
        }
Exemplo n.º 2
0
        private void ProcessGoals(KickFireModel model)
        {
            var identificationGoal = AnalyticsConfigurationHelper.IdentificationGoal();

            if (identificationGoal != null && model.Data[0].Confidence > 70)
            {
                //_eventTrackerService.TrackGoal(identificationGoal.ID.ToGuid());

                //var companyConnectService = new CompanyConnectService();

                //companyConnectService.AddXconnectGoal(identificationGoal.ID.ToGuid(), Tracker.Current.Interaction.UserAgent, new ID("{B418E4F2-1013-4B42-A053-B6D4DCA988BF}").ToGuid());
            }
        }
Exemplo n.º 3
0
 private static bool ShouldProcessIsp(KickFireModel model)
 {
     return(!AnalyticsConfigurationHelper.SkipIsp() ||
            AnalyticsConfigurationHelper.SkipIsp() && model.Data[0].IsIsp == 0);
 }
        public override void Process(CreateVisitArgs args)
        {
            var companyService = DependencyResolver.Current.GetService <ICompanyService>();

            Assert.ArgumentNotNull(args, "args");
            Assert.IsNotNull(args.Session, "args.Session is null");
            Assert.IsNotNull(args.Session.Contact, "args.Session.Contact is null");
            Assert.IsNotNull(companyService, "Company service can not be null");

            // convert the IP from the tracker
            var clientIp = args.Session.Interaction.Ip[0] + "."
                           + args.Session.Interaction.Ip[1] + "."
                           + args.Session.Interaction.Ip[2] + "."
                           + args.Session.Interaction.Ip[3];

            if (args.Request.Params["Spoof"] != null)
            {
                clientIp = args.Request.Params["Spoof"];
            }

            //if (clientIp.StartsWith("127"))
            //    clientIp = "23.0.59.195";

            Log.Info("KickFire: ====== Starting Kickfire for " + clientIp + "======", "KickFire");

            Log.Info("KickFire: GEOIP Country IS : " + Tracker.Current.Session.Interaction.GeoData.Country, "KickFire");

            // make the call
            try
            {
                // check to see if we only want USA to keep the API hits down
                if (AnalyticsConfigurationHelper.OnlyUsa() &&
                    (Tracker.Current.Session.Interaction.GeoData.Country != "United States" &&
                     Tracker.Current.Session.Interaction.GeoData.Country != "US"))
                {
                    Log.Info("KickFire: Not USA, kicking out", "KickFire");
                    return;
                }

                var model = companyService.GetRootObject(clientIp);

                // Make sure our request is good.
                if (model != null &&
                    model.status == "success" &&
                    model.data.Count > 0
                    &&
                    (!AnalyticsConfigurationHelper.SkipIsp() ||
                     (AnalyticsConfigurationHelper.SkipIsp() && model.data[0].isISP == 0)))
                {
                    // add company data to xDB
                    AddCompanyData(model);

                    // add company information node
                    AddCompanyInformation(model);

                    // add the page event
                    //Helpers.Events.PageEvent.RegisterCompanyEvent(model.data[0].name);

                    Log.Info("KickFire: Logged for " + clientIp, "KickFire");

                    var processSicCode = false;
                    bool.TryParse(Sitecore.Configuration.Settings.GetSetting("Bonfire.Kickfire.ProcessSicCode"), out processSicCode);

                    if (processSicCode)
                    {
                        ProcessSicCode(clientIp, model);
                    }

                    // lets kick off the Engagement Plan
                }
                else
                {
                    if (model == null)
                    {
                        Log.Info("KickFire: Model null. IP is " + clientIp, this);
                    }

                    else
                    {
                        if (model.status != "success")
                        {
                            Log.Info("KickFire: Model capture not successful. IP is " + clientIp, "KickFire");
                        }

                        if (model?.data?.Count == 0 && model.data == null)
                        {
                            Log.Info("KickFire: No data records. IP is " + clientIp, "KickFire");
                        }

                        if (model?.data != null && model?.data[0].isISP != 0)
                        {
                            Log.Info("KickFire: Is ISP, skipped. IP is " + clientIp, "KickFire");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("KickFire: KickFire Error" + ex.Message, ex);
            }
        }