You can do it programmatically. Below is the steps to be able to implement this easily.
Trigger a goal programmatically.
Since you have the goal id, you can get the goal item and then read the tracking field.
Here is a snippet on how to read the Tracking Field
TrackingField trackingField;
ProfileUtil.GetProfiles(item, out trackingField);
- Once you have the profile card, you can set the pattern card on the user.
Below is a code snippet on how to assign the pattern card to a user:
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);
}
}
// Set a score value here
scores[patternCard.Name] = 5;
profile.Score(scores);
profile.PatternId = patternCard.ID.ToGuid();
profile.PatternLabel = patternCard.Name;
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);
}
}
}
More information can be found here: Programmatically Trigger a Pattern Card/Profile Card in a selected content in Sitecore