Last active
August 29, 2015 14:16
-
-
Save daniiiol/bf41a88fc6dc946b9886 to your computer and use it in GitHub Desktop.
Sitecore Campaign Association on each Visit-Request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Sitecore.Analytics.Pipelines.TriggerCampaign; | |
using Sitecore.Diagnostics; | |
namespace Sitecore8rev150223.Website.Pipelines | |
{ | |
public class AssociateCampaignToVisit : TriggerCampaignProcessor | |
{ | |
public override void Process(TriggerCampaignArgs args) | |
{ | |
Assert.ArgumentNotNull((object)args, "args"); | |
// Always associate the campaign to the current visit when triggered | |
Sitecore.Analytics.Tracker.Current.Interaction.CampaignId = args.Definition.ID.ToGuid(); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<triggerCampaign> | |
<processor type="Sitecore.Analytics.Pipelines.TriggerCampaign.CheckPreconditions,Sitecore.Analytics"/> | |
<processor type="Sitecore.Analytics.Pipelines.TriggerCampaign.HandleTrafficType,Sitecore.Analytics"/> | |
<processor type="Sitecore.Analytics.Pipelines.TriggerCampaign.RunRules,Sitecore.Analytics"/> | |
<processor type="Sitecore.Automation.MarketingAutomation.Pipelines.TriggerCampaign.RunAutomation,Sitecore.Analytics.Automation"/> | |
<processor type="Sitecore.Analytics.Pipelines.TriggerCampaign.RegisterPageEvent,Sitecore.Analytics"/> | |
<processor type="Sitecore8rev150223.Website.Pipelines.AssociateCampaignToVisit,Sitecore8rev150223.Website"/> | |
</triggerCampaign> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
<sitecore> | |
<triggerCampaign> | |
<processor | |
type="Sitecore8rev150223.Website.Pipelines.AssociateCampaignToVisit,Sitecore8rev150223.Website" | |
patch:after="processor[@type='Sitecore.Analytics.Pipelines.TriggerCampaign.RegisterPageEvent,Sitecore.Analytics']"> | |
</processor> | |
</triggerCampaign> | |
</sitecore> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment