5

Has anyone tried to stop a Profile Card assigned to a page from being repeatedly applied to a user in a single session?

For example if the user hits F5 the Profile Card points are applied to the user again. Ideally we only want the Profile Card to only be applied the first time the visitor visits the page during a session.

If the same Profile Card is assigned to another page which the user visits the points should be added again.

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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