Add custom scoring
The main two pillars of personalization that the Umbraco Engage offers are personas and customer journeys.
ICustomerJourneyGroupRepository _customerJourneyGroupRepository;ICustomerJourneyService _customerJourneyService;public MyController(ICustomerJourneyGroupRepository customerJourneyGroupRepository, ICustomerJourneyService customerJourneyService){ _customerJourneyGroupRepository = customerJourneyGroupRepository; _customerJourneyService = customerJourneyService;}var customerJourneyGroup = _customerJourneyGroupRepository.GetAll().FirstOrDefault(group => group.Title == "Customer Journey");
var stepDo = customerJourneyGroup.Steps.FirstOrDefault(step => step.Title == "Do");_customerJourneyService.ScoreCustomerJourneyStep(stepDo.Id, 100);public IActionResult ResetPersonaScoreToZero(long personaId){ var visitorId = _visitorContext.GetVisitorExternalId(); if(visitorId.HasValue) { var personaGroups = _personaGroupRepository.GetPersonaScoresByVisitor(visitorId.Value); var personaGroup = personaGroups.FirstOrDefault(x => x.Personas.Any(y => y.Id == personaId)); var persona = personaGroup?.Personas.FirstOrDefault(x => x.Id == personaId); if (persona != null) { _personaService.ScorePersona(visitorId.Value, personaId, persona.Score * -1); return Ok($"Subtracted {persona.Score} from visitor {visitorId}"); } } return Ok("OK");}Last updated
Was this helpful?