public ActionResult Index(string email)
        {
            string identificationSource = "website";

            Sitecore.Analytics.Tracker.Current.Session.Identify(identificationSource, email);
            var contact = Sitecore.Analytics.Tracker.Current.Contact;
            var emails  = contact.GetFacet <IContactEmailAddresses>("Emails");

            if (!emails.Entries.Contains("personal"))
            {
                emails.Preferred = "personal";
                var personalEmail = emails.Entries.Create("personal");
                personalEmail.SmtpAddress = email;
            }

            var outcome = new Sitecore.Analytics.Outcome.Model.ContactOutcome(
                Sitecore.Data.ID.NewID,
                new Data.ID("{EC97DE22-55CC-4A65-AACB-50435781D7D6}"),
                new Data.ID(Tracker.Current.Contact.ContactId)
                );

            Tracker.Current.RegisterContactOutcome(outcome);

            var pageEventData = new Sitecore.Analytics.Data.PageEventData("Newsletter Signup")
            {
                Text = "user subsribed."
            };

            Tracker.Current.Interaction.CurrentPage.Register(pageEventData);

            return(PartialView("~/Views/SubscribeForm/Confirmation.cshtml"));
        }
        public override void Execute(ID formId, AdaptedResultList adaptedFields, ActionCallContext actionCallContext = null, params object[] data)
        {
            try
            {
                if (Tracker.Current == null)
                {
                    return;
                }

                ID id            = Sitecore.Data.ID.NewID;
                ID interactionId = Sitecore.Data.ID.NewID;
                ID contactId     = Sitecore.Data.ID.NewID;

                // definition item for Marketing Lead
                var definitionId = Site.Foundation.Analytics.FoundationAnalyticsConstants.Outcomes.MarketingLeadOutcomeId;

                var outcome = new Sitecore.Analytics.Outcome.Model.ContactOutcome(id, definitionId, contactId)
                {
                    DateTime      = DateTime.UtcNow.Date,
                    MonetaryValue = 0,
                    InteractionId = interactionId
                };

                Tracker.Current.RegisterContactOutcome(outcome);

                Log.Audit("WFFMTriggerOutcome : Outcome recorded ", this);
            }
            catch (Exception e)
            {
                Log.Error("WFFMTriggerOutcome : Exception occured while triggering outcome " + e.Message, this);
            }
        }
        private void RegisterIdentificationOutcome(Contact contact, RegisterPageEventArgs args)
        {
            ID id            = Sitecore.Data.ID.NewID;
            ID interactionId = Sitecore.Data.ID.NewID;
            ID contactId     = Sitecore.Data.ID.NewID;

            // definition item for Sales Lead
            var definitionId = FoundationAnalyticsConstants.Outcomes.MarketingLeadOutcomeId;

            var outcome = new Sitecore.Analytics.Outcome.Model.ContactOutcome(id, definitionId, contactId)
            {
                DateTime      = DateTime.UtcNow.Date,
                MonetaryValue = 0,
                InteractionId = interactionId
            };

            Tracker.Current.RegisterContactOutcome(outcome);
        }
Exemplo n.º 4
0
        public ActionResult Index(string email)
        {
            // 10.3 Add entered email to session
            Sitecore.Analytics.Tracker.Current.Session.Identify(email);
            string message = "";

            var contact = Sitecore.Analytics.Tracker.Current.Contact;

            var emails = contact.GetFacet <IContactEmailAddresses>("Emails");

            if (!emails.Entries.Contains("personal"))
            {
                var personalEmail = emails.Entries.Create("personal");

                personalEmail.SmtpAddress = email;
                emails.Preferred          = "personal";
                message = "Email Added; ";
            }

            // 10.4 Add Outcome Subscribed
            Sitecore.Data.ID outcomeID = new Sitecore.Data.ID("{C41E28D0-66C4-423F-84D5-09DEABD6294A}");
            Sitecore.Data.ID contactID = new Sitecore.Data.ID(contact.ContactId);

            var co = new Sitecore.Analytics.Outcome.Model.ContactOutcome(Sitecore.Data.ID.NewID, outcomeID, contactID);

            Sitecore.Analytics.Tracker.Current.RegisterContactOutcome(co);

            message += "Subscribed; ";

            // 10 optional
            Sitecore.Analytics.Data.PageEventData pageEvent = new Sitecore.Analytics.Data.PageEventData("Newsletter Signup");

            var page = Sitecore.Analytics.Tracker.Current.CurrentPage;

            page.Register(pageEvent);

            message += "Registered; ";

            TempData["message"] = message;

            return(View("Confirmation"));
        }
        public ActionResult Index(string email)
        {
            Sitecore.Analytics.Tracker.Current.Session.Identify(email);
            var contact = Sitecore.Analytics.Tracker.Current.Contact;
            var emails  = contact.GetFacet <IContactEmailAddresses>("Emails");

            if (!emails.Entries.Contains("personal"))
            {
                emails.Preferred = "personal";
                var personalEmail = emails.Entries.Create("personal");
                personalEmail.SmtpAddress = email;
            }

            var outcome = new Sitecore.Analytics.Outcome.Model.ContactOutcome(Sitecore.Data.ID.NewID, new Sitecore.Data.ID("{322343ED-74CC-4C2E-9ECF-6E6596E20AE4}"), new Sitecore.Data.ID(Sitecore.Analytics.Tracker.Current.Contact.ContactId));

            Sitecore.Analytics.Tracker.Current.RegisterContactOutcome(outcome);

            var subscribeEmail = new SubscribeEmail()
            {
                emailRec = email
            };

            return(View("Confirmation", subscribeEmail));
        }