5 Replies Latest reply on Dec 17, 2012 9:00 AM by mike_ottinger

    Resolving segments based on request attributes

    mike_ottinger

      We have an architectural requirement for CQ5.5 to be situated behind an application in which it acts as a "content provider" rather than the application interfacing directly with the client. We also have a requirement to leverage client contexts and segmentation. Reading further into segmentation, it seems what CQ uses is based primarily on the profile of the user in CQ5. There are other factors such as IP, geo location and device type that can also be used to resolve segments, but given that we won't have users interfacing directly with CQ, is there a way to have CQ resolve segments based on request attributes passed into CQ?

       

      Thanks in advance

        • 1. Re: Resolving segments based on request attributes
          GROM!T

          Since the entire segmentation logic takes place on the client (it's all Javascript) it is not necessary, to send any parameters to CQ.

           

          We had the same requirement and solved it by creating a new context-store that simply reads a Javascript array (placed in the page) and stores it's values. You can find the provided context-stores under /libs/cq/personalization/components/contextstores. Just copy an easy one, strip it and implement a few lines, that parse the javascript array.

           

          To process these parameters we added a new trait (find the provided ones here: /libs/cq/personalization/components/traits), which simply compares a freely definable variable name with a value. Don't forget to add a selection to the trait dialog, which allows setting the value of "numberFormat" to "" or "parseInt". Otherwise it will not be possible to handle numbers and strings.

           

          Cheers

          Robert

          • 2. Re: Resolving segments based on request attributes
            mike_ottinger Level 1

            Excellent, thanks so much for the info. I'll dig into this and take a look.

             

            Thanks again!

            • 3. Re: Resolving segments based on request attributes
              mike_ottinger Level 1

              Thanks again for the pointers. One question remaining with regards to rendering teasers via ajax when CQ5 is behind an application. The javascript within the initializeTeaserLoader function is performing an ajax GET back to the local cq server. In the scenario where CQ5 is behind a separate application layer, this obviously won't work. How was this addressed? I can think of two solutions:

               

              - modify the /libs/cq/personalization/clientlib/source/teaser/teaser-client.js to make a jsonp call

              - have the application layer out in front proxy these calls back to CQ5

               

              Just curious how this was addressed in similar architectures.

               

              Thanks again!

              • 4. Re: Resolving segments based on request attributes
                GROM!T Level 1

                Ok, our case was a bit easier since we do not hide our CQ fully behind an application - as you do - but we have both running in parallel and both are directly available to the clients. To route the request to the right application (CQ vs. App) we use our load balancer to determine the correct app via an url schema (/content and /etc go to CQ).

                 

                Cheers

                Robert

                • 5. Re: Resolving segments based on request attributes
                  mike_ottinger Level 1

                  Thanks Robert, this could also be a possibility in our architecture as well. Thanks for solution #3