将Sitecore访问者映射到自定义渠道

时间:2016-10-03 09:25:13

标签: sitecore sitecore8

我有一些联盟网站,链接到我的Sitecore网站。

我为这些联属网站创建了一个自定义渠道。我想要做的是根据Referred HTTP标头将这些访问者映射到自定义频道,这样我就可以根据频道对组件进行个性化设置。

Sitecore没有在我看来很好地记录这一部分,我在互联网上找不到太多。

我该怎么做? 我是否需要自己的程序管道,或者是Sitecore的默认功能吗?

修改 interactionChannelMappings应该有办法解决这个问题 这是来自Sitecore.Social.config文件

的一些xml
 <interactionChannelMappings>
     <!-- 41-91-05: Online/Social Community/Facebook Social Community -->
     <channel channelId="{A9F2D058-95A5-4461-B1E5-8502D2303AF1}">
        <!-- Facebook -->
        <channelMapping urlReferrerHost="www.facebook.com" />
        <!-- Facebook for mobile -->
        <channelMapping urlReferrerHost="m.facebook.com" />
        <!-- Facebook's Link Shim -->
        <channelMapping urlReferrerHost="l.facebook.com" />
        <!-- Facebook's Link Shim for mobile -->
        <channelMapping urlReferrerHost="lm.facebook.com" />
     </channel>  
 </interactionChannelMappings>

它看起来像通配符。但是我在哪里放这个(我不想在Sitecore.Social.config文件中。我还需要什么其他代码?除了this之外,我在Sitecore网站上找不到任何文档< / p>

2 个答案:

答案 0 :(得分:1)

将访问映射到渠道的一种方法是使用广告系列,但这需要链接包含广告系列标识符。

另一种方法是使用API​​设置当前交互的ChannelId。这可以在您已经提到的管道中完成,以确保它在每个请求上完成(会话的第一个请求实际上足够了)。

虽然可能还有其他方法......

编辑使用API​​:创建一个这样的类,并在默认的SetChannel之后将其添加到CreateVisit管道中(使用配置补丁)。

public class SetChannel : CreateVisitProcessor
{
    public override void Process(CreateVisitArgs args)
    {
      Guid channelID = ... // Get your channel ID
      args.Interaction.ChannelId = channelID;
    }
}

Edit2:interactionChannelMappings确实是一个选项。从来没有尝试过,但通过使用配置补丁添加你的频道及其映射应该相当容易。在查看读取该配置时执行的代码时,它应该执行您想要的操作(即根据引用者设置通道)。所以不需要自定义代码。 有关配置修补的更多信息,请访问:https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/all-about-web-config-include-files-with-the-sitecore-asp-net-cms。如有疑问,请使用/sitecore/admin/showconfig.aspx检查结果。

答案 1 :(得分:0)

这就是我要找的: 创建自己的频道项,例如:

/sitecore/system/Marketing Control Panel/Taxonomies/Channel/Online/Affiliates/Site2

创建自己的Traffictype:

/sitecore/system/Settings/Analytics/Traffic Type/Affiliate

Add the channel mapping到Sitecore.Analytics.Compatibility.config:

<add trafficType="TRAFFIC-ID" channel="{CHANNEL-ITEM-GUID}" />

使用以下命令创建一个新的.config:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <social>
      <interactionChannelMappings>
        <channel channelId="{CHANNEL-ITEM-GUID}">
          <!-- affiliate wildcards -->
          <channelMapping urlReferrerHost="site2.com" />
        </channel>
      </interactionChannelMappings>
    </social>
  </sitecore>
</configuration>

来自site2.com的访问现在应自动映射到新创建的自定义渠道