Monday, February 3, 2014

Context Expression Extension

I this post I will cover a brand new feature added in Tridion 2013 SP1 called Context Expression Extension (CEE). CEE is part of Tridion 2013 SP1 and is installed as a GUI Extension that will mark Target Groups as Context Expressions. Additionally it has Content Delivery pieces that will be described later in this post.

CEE integrates SDL Tridion with Campaign Management and Analysis Data (CMA) allowing marketers and data analysts to define Expressions in CMA and push them into Tridion in the form of Target Groups. Context Expression Target Groups are read only and can just be updated in CMA, as a personal quote for future releases it would be nice if we can generate Context Expressions from external systems or within the Tridion user interface.

CEE updates how a Target Group looks like if it recognizes that it contains a Context Expression as you can appreciate in the following pictures.








Context Expressions Target Groups are named in the form of [aspect].[property]













CEE will show an extra tab called Context Expression that shows the Expression in read only mode.

Publishing Context Expressions

Context Expressions integrates perfectly with Context Engine Cartridge (CEC) providing access to the Expression in the Presentation Server by publishing the Context Expression Target Group using a new feature called Dynamic Vocabulary. So you may be thinking what is a dynamic vocabulary and what is an static vocabulary instead? Well I will try to explain it. I will call a static vocabulary to the set of expressions that are configured in the cwd_engine_vocabulary_conf.xml. So what is a dynamic vocabulary? Well it is the set of expressions that are published from Tridion (Target Groups Publishing).

You might be asking where are those expressions published, well they are pushed to the Ambient Data Framework (ADF) making them available as claims and eventually available for Tags like If or Eval

Targeting Component Presentations using Context Expressions

The process to target Component Presentations is the same to the one used with P&P (Personalization & Profiling), it is done in the Page - Component Presentations tab. Below a sample.




















After publishing the Page you will see content like the following.

<context:If Expression="(os.apple)" runat="server">
    <span>
        <!-- Start Component Presentation: {"ComponentID" : "tcm:5-2051", "ComponentModified" : "2014-02-03T19:39:54", "ComponentTemplateID" : "tcm:5-1058-32", "ComponentTemplateModified" : "2013-12-26T16:18:55", "IsRepositoryPublished" : false } -->
        <div>

            <h2>
                <span>
                    <!-- Start Component Field: {"XPath":"tcm:Content/custom:Content/custom:Heading[1]"} -->
                    <h1><strong>Article For Apple Devices
                    </strong></h1>
                </span>
            </h2>



            <p>
                <span>
                    <!-- Start Component Field: {"XPath":"tcm:Content/custom:Content/custom:Description[1]"} -->
                    This is a description for <strong>Article For Apple Devices.</strong>
                </span>
            </p>

        </div>
    </span>
</context:If>
<context:If Expression="(os.notapple)" runat="server">
    <span>
        <!-- Start Component Presentation: {"ComponentID" : "tcm:5-51", "ComponentModified" : "2014-02-03T17:59:54", "ComponentTemplateID" : "tcm:5-1058-32", "ComponentTemplateModified" : "2013-12-26T16:18:55", "IsRepositoryPublished" : false } -->
        <div>

            <h2>
                <span>
                    <!-- Start Component Field: {"XPath":"tcm:Content/custom:Content/custom:Heading[1]"} -->
                    <h1>This is a Non Apple Devices Article
                    </h1>
                </span>
            </h2>



            <p>
                <span>
                    <!-- Start Component Field: {"XPath":"tcm:Content/custom:Content/custom:Description[1]"} -->
                    This is a description for Non Apple Devices
                </span>
            </p>

        </div>
    </span>
</context:If>

A Context Expression Target Group is transformed in a <context:if> tag by a TCDL Tag Transformed that is configured in the Deployer.

<TCDLEngine>
                <Properties>
                                <Property Name="tcdl.dotnet.style" Value="controls"/>
                                <Property Name="tcdl.jsp.style" Value="tags"/>
                </Properties>
               
                <TagBundle Resource="com/sdl/context/transformer/contextTagTransformerBundle.xml" />
</TCDLEngine>

The final result is shown below (Please note that in order to have your web application working you have to have a Context Engine Cartridge configured and working).

Non Apple Device Result



Apple Device Result