In order to do this, you will need to have a pipeline in the <processItem>
tag. You can read my post here.
Configuration File
You will need to patch the Sitecore Process Profile processor with a custom one. The custom processor will check if the Profile to be processed has already been added to the user profile.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<processItem>
<processor type="YourNamespace.ProcessProfileProcessor,YourAssembly"
patch:instead="processor[@type='Sitecore.Analytics.Pipelines.ProcessItem.ProcessProfiles, Sitecore.Analytics']"/>
</processItem>
</pipelines>
</sitecore>
</configuration>
Code
This is the entry point. At this point, the method ProcessProfiles will be called and as parameters, the tracking and interaction are passed.
public class ProcessProfileProcessor : ProcessItemProcessor
{
public override void Process(ProcessItemArgs args)
{
Assert.ArgumentNotNull((object) args, "args");
foreach (TrackingField trackingParameter in args.TrackingParameters)
{
TrackingProcessor.ProcessProfiles(args.Interaction, trackingParameter);
}
}
}
Your main logic to see if Profile needs to be processed for the user can be performed within the ProcessProfiles
method.
public static class TrackingProcessor
{
public static void ProcessProfiles(CurrentInteraction interaction, TrackingField field)
{
// Your Logic goes here.
}
}
You may check my blog as referenced above for more information.