2

I want my component presentation to be personalized depending on a customer characteristic (customerType). We show different component presentations depending different customerType accessing to the page. customerType will come from java backend logic(as of now I am bringing from URL request parameters). I am done with following steps:- Create Target Group.
Add Target group with a component presentation on the page.

condition will be used by Tridion CD APIs. Published page has my Component Presentation wrapped with tag below :-

        <div>
<tridion:TargetGroup itemURI="tcm:100-1000000-64">
    <tridion:Conditions negate="false" operator="AND">
    <tridion:Conditions negate="false" operator="OR">
    <tridion:Conditions negate="false" operator="AND">
    <tridion:Condition type="CustomerCharacteristic" operator="=" negate="false" name="customerType" value="1"/>
    <tridion:Condition type="CustomerCharacteristic" operator="=" negate="false" name="customerType" value="0"/>
    </tridion:Conditions>
    </tridion:Conditions>
    </tridion:Conditions>
    <form:form action="****" method="post" commandName="**"  id="location">
    <input type="submit" value="AppLoc" id="AppLoc" style="display:none;" />
    <div class="" role="main">
      <table>
        <tr>
             <td >Branch</td>
             <td ><div>abc</div></td>
          </tr
      </table>
     </div>
    </form:form>
    </tridion:TargetGroup>
</div>

What I am able to find is CD API com.tridion.personalization and below is my code

    <%@ page import="com.tridion.web.jsp.JSPPage,
    com.tridion.personalization.CustomerCharacteristics,
    com.tridion.user.User"%>

    <%
    JSPPage waiPage = new JSPPage(pageContext, "tcm:1-1-64");
    CustomerCharacteristics customerCharacteristics = new CustomerCharacteristics(waiPage.getUser());
    String custT = request.getParameter("customerType");
    customerCharacteristics.setValue("customerType", custT);
    customerCharacteristics.executeUpdate();


      %>
    <html>
      <head></head><body>
        <hr color="#000000" /> <center>

    <h3><%="- " + customerCharacteristics.getValue("customerType")%> </h3>
    <h3><%="----  :" + waiPage.getUser()%> </h3>

    <div>
<!-- Below conditions updated ad per the suggestion provided by Bjørn van Dommelen -->
    <tridion:TargetGroup itemURI="tcm:159-164141-64">
    <tridion:Conditions negate="false" operator="AND">
    <tridion:Condition type="CustomerCharacteristic" operator="=" negate="true" name="customerType" value="2"/>
    </tridion:Conditions> 
        <div class="" role="main">
          <table>
            <tr>
                 <td >Branch</td>
                 <td ><div>abc</div></td>
              </tr
          </table>
         </div>   
        </tridion:TargetGroup>
    </div>
      </center>
      </body>
      </html>`

I am getting my entries in CUSTOMER_CHARACTERISTICS and User table in Broker database. I think only think left now is condition.

  • are you using dd4t? – Raj Kumar Sep 2 '15 at 14:24
  • No Raj simple JSP.. – Aman Sep 3 '15 at 6:54
  • @RajKumar Thanks for the URLs I am able to proceed with the code and I have updated my question with my progress. – Aman Sep 4 '15 at 12:54
1

I recently used Target group on DXA, Please use following links to understand it better.

| improve this answer | |
  • Documentation is ContentDeliveryReferenceGuide_51SP4.pdf and SDL Tridion R5 Content Delivery Project Planning Guide 5.3 SP1_tcm89-17676.pdf and SDL Tridion R5 Templating Manual 5.3 SP1_tcm89-17683.pdf Thanks @RajKumar – Aman Sep 9 '15 at 9:18
0

1) Your conditions appear bogus. You're doing an AND of an OR of an AND of two complementary conditions (User type cannot be both 1 and 0 at the same time). In your scenario i'd expect the following (but depends on business requirements ofc):

<tridion:Conditions negate="false" operator="OR">
  <tridion:Condition type="CustomerCharacteristic" operator="=" negate="false" name="customerType" value="1"/>
  <tridion:Condition type="CustomerCharacteristic" operator="=" negate="false" name="customerType" value="0"/>
</tridion:Conditions>

2) You're not using a dynamic component presentation. I'm pretty a WAI tracking tag must be used like so:

<tridion:TargetGroup itemURI="tcm:1-2-64">
  <tridion:Conditions negate="false" operator="OR">
    One or more condition tags go here
  </tridion:Conditions>
  <tridion:ComponentPresentation componentUri="tcm:1-3" templateUri="tcm:1-4-32" />
</tridion:TargetGroup>

This means your component presentation must be a statically assembled dynamic component presentation and not a statically embedded one like you are showing.

| improve this answer | |
  • Thanks for looking into the post , even if I keep only one condition I still get 3 <tridion:Conditions tags. This is automatically added while publishing and I have rechecked my PT code it is only having 1 time TBB added - "Default Finish Actions". Coming Back to Component presentation I am using a CT which is "published Embedded on Page". Also I am only using characteristics in Target group and no Tracking. My question here will be I can used only characteristics for personalization and through code I can set the characteristics and Can we use it on CP which I am using? – Aman Sep 4 '15 at 12:53
  • My business case is like I have to show hide CP based on customerType coming from backend or URL. So you mean yo say I should make my CT as - "Published as dynamic component" also I am not using categories in my schema as I believe it only in case of tracking which I am not doing. – Aman Sep 4 '15 at 13:51
0

Things mentioned above in my question is working perfectly, only issue was my CD_tags.tld now not configured properly and neither it was giving any logs. I changed the element, double checked the Web.xml and rebuild/ redeployed the application. It worked.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.