Skip to content

Instantly share code, notes, and snippets.

@hishaamn
Created July 19, 2017 14:13
Show Gist options
  • Select an option

  • Save hishaamn/87103c7b0cbab50004f85e05fd086783 to your computer and use it in GitHub Desktop.

Select an option

Save hishaamn/87103c7b0cbab50004f85e05fd086783 to your computer and use it in GitHub Desktop.
public static class TrackingProcessor
{
public static void ProcessProfiles(CurrentInteraction interaction, TrackingField field)
{
Assert.ArgumentNotNull(interaction, "interaction");
Assert.ArgumentNotNull(field, "field");
foreach (var profile1 in field.Profiles)
{
if (profile1.Name.Equals("Your Profile Name Here"))
{
continue;
}
var contentProfile = profile1;
if (contentProfile.IsSavedInField)
{
var key = contentProfile.Key;
if (!string.IsNullOrEmpty(key))
{
var profile = interaction.Profiles[key];
profile.Score(contentProfile);
TrackerEvents.OnCurrentPageCancelled += ((sender, args) =>
{
profile.RollBackScore(contentProfile);
if (profile.Count != 0)
{
return;
}
interaction.Profiles.Remove(profile.ProfileName);
});
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment