James Walford
James Walford

Reputation: 2953

How should I start a Sitecore campaign when the entrance page is an alias?

We have a site with extensive use of product specific contact forms (Web forms for marketers module), so that almost any page can be considered a landing page. We want to run campaigns that make use of existing pages/forms instead of creating new pages specific to the campaign. As we want to initiate these campaigns off-line we will be making use of aliases to provide short URLs for printed campaign material. How can we trigger a campaign when an existing page is viewed under an alias, but not when it's reached from another source (e.g. organic search, internal site link, other campaign)?

Upvotes: 2

Views: 373

Answers (1)

Ian Graham
Ian Graham

Reputation: 3216

You could do something custom with the AliasResolver pipeline processor.

In this processor you could trigger certain campaigns if a certain alias was accessed.

Here's how to set up an alias resolver:

http://sitecoreblog.patelyogesh.in/2013/08/sitecore-item-alias-alternate-url.html

Also code to trigger campaign is here:

http://www.alen.me.uk/2014/05/trigger-sitecore-dms-campaign-via-ajax.html

A more elegant solution would be to incorporate the rules engine into the logic that determines which alias triggers what campaign. You can do this by following these steps:

  1. Add a new Rules field to the alias item in Sitecore by inheriting a new template
  2. Add code in the custom AliasResolver to run the rules on the Alias that the AliasResolver resolves - some example code here which uses Outcomes but you could switch this out for Alias items. - https://github.com/ianjohngraham/CoreBlimey.Utils/blob/master/CoreBlimey.OutcomeRules/Pipelines/RunOutcomeRules.cs

  3. Add rule actions to each Alias e.g trigger campaign x. There should already be an action in the rules engine to trigger a campaign, if not you can easily write one.

With this set up, when the Alias is resolved the correct campaign can be triggered and it is all configurable within Sitecore.

Upvotes: 4

Related Questions