I have a question about triggering profiles associated with an item. If a visitor visits a page, the profiles associated with that page are triggered for that visitor.
How can I trigger the profiles associated with an item in code? The item is not a page. I only want to trigger the profiles if a visitor matches some kind of conidtion.
Thank you!
This is all done through the
startTrackingpipeline. Unfortunately, it looks as if Sitecore has "hard coded" the pipeline to use the Context Item. You should be able to accomplish this though by replacing theProcessItemprocessor.Note: The following is untested.
Sitecore.Analytics.Pipelines.StartTracking.StartTrackingArgswhich has anItempropertySitecore.Analytics.Pipelines.StartTracking.ProcessItem. Use reflector or ILSpy to pull the existing logic of theProcessmethod. If theStartTrackingArgspassed in are of your subclass, and anItemproperty is specified, use it instead of the context item.ProcessItemin thestartTrackingpipeline using an Include config with a patch:attribute.StartTrackingArgsand callSitecore.Analytics.Pipelines.StartTracking.StartTrackingPipeline.Run(yourArgs).