1

Currently we have defined patterns to determine if the visitor is a job seeker, an advisor, a client...

However, visitors who do not fall into one of these categories do not appear in Sitecore reports.

The SEO team would therefore like these visitors to be assigned a default pattern and for the displayed pie to be complete (showing all visitors)

Can implementing this practice cause problems in our sitecore customization? Is this practice recommended? If not, why not and what is the solution? Currently to match the number of unknown visitors to those who are job seekers, counsellors, or clients. We need to go into adobe analytic and find the number of unique visitors and then subtract this number from the data coming from the sitecore customization.

Honestly, it's not really practical and not at all effective.

Do you have a solution or recommendation?

  • This question is probably too broad for the Q&A format of SSE. Can you condense it down to a single answerable question that would be better. If a discussion is still needed, this would be better on Sitecore Slack – Richard Seal Feb 25 '19 at 14:44
  • Indeed, I must admit that my question could have been more precise and condensed. However, our team had already submitted the same kind of questions about the Sitecore Slack channel and we didn't really have a solution. I think Hishaam Namooya's answer is exactly what we were looking for. However, I will be careful to be more condensed next time. Thank you for your constructive feedback! – Sébastien Thibault Feb 25 '19 at 19:34
1

It is not necessarily a bad practice or cause any issues. If you are using the Sitecore Personalization rules, you can target the profiles which are associated to the user. If no profile is found, this means the user is not in a particular segment.

Now, in order for you to tag the user with a profile, you will need to add a pipeline in the <startTracking>. This pipeline will have the task to boost the user profile to the default one, let's say Unknown Category.

Below is a code snippet that I was using on Sitecore 8 to boost the user pattern of the user.

public static void BoostUserPattern(Session userSession, string patternName)
{
    var patternCards =
        Context.Database.GetItem("Path or Id of required Profile pattern card container").Children;

    var patternCard = patternName.ToLower().Equals("register")
        ? patternCards.FirstOrDefault(w => w.Name.ToLower().Equals("register"))
        : patternCards.FirstOrDefault(w => w.Name.ToLower().Equals("unknown"));

    if (patternCard == null)
    {
        return;
    }

    var profile = Tracker.Current.Interaction.Profiles[patternCard.Parent.Parent.Name];

    BoostUserPattern(userSession, patternCard, profile);
}

public static void BoostUserPattern(Session session, Item patternCard, Profile profile)
{
    if (patternCard != null && !patternCard.Name.Equals(profile.PatternLabel))
    {
        Sitecore.Data.Fields.XmlField xmlData = patternCard.Fields["Pattern"];
        XmlDocument xmlDoc = xmlData.Xml;

        XmlNodeList parentNode = xmlDoc.GetElementsByTagName("key");
        var scores = new Dictionary<string, float>();

        foreach (XmlNode childrenNode in parentNode)
        {
            if (childrenNode.Attributes != null)
            {
                scores.Add(childrenNode.Attributes["name"].Value, 0);
            }
        }

        // Boost profile key(s) here
        scores[patternCard.Name] = 5;

        profile.Score(scores);

        profile.PatternId = patternCard.ID.ToGuid();
        profile.PatternLabel = patternCard.Name;

        // Update the historical data for the user
        UpdateBehaviorProfile(session);
    }
}

private static void UpdateBehaviorProfile(Session session)
{
    var profileConverterBase = BehaviorProfileConverterBase.Create();

    if (session?.Contact == null || Tracker.Current.Interaction == null)
    {
        return;
    }

    session.Contact.BehaviorProfiles.RemoveAll();

    foreach (var profileName in session.Interaction.Profiles.GetProfileNames())
    {
        var profile = session.Interaction.Profiles[profileName];

        if (!IgnoreInteractionProfile(profile))
        {
            var matchedBehaviorProfile = profileConverterBase.Convert(profile);

            session.Contact.BehaviorProfiles.Add(matchedBehaviorProfile.Id, matchedBehaviorProfile);
        }
    }
}

private static bool IgnoreInteractionProfile(Profile profile)
{
    Assert.ArgumentNotNull(profile, "profile");

    return false;
}

EDIT

As you would see, the method UpdateBehaviorProfile will add the profile to the historic data. In other words, if a user has no profile, going through the boosting mechanism will push the profile up to the historical data.

  • Thank you very much for your answer, I think it answers my question quite well. I'll try everything. Your solution seems very logical to me! – Sébastien Thibault Feb 25 '19 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.