Suren Konathala
Suren Konathala

Reputation: 3597

Offers / experiences not visible on Publish instance using contexthub for personalization on AEM 6.2

I’m using AEM’s default targeting to add an experience for a user. I’m using “gender equals male” as a simple trait to try the sample text to show up.

I’ve setup to create an experience for logged in users to see different TEXT based on their gender (as an example). And on Publishing the content and login into to our portal on Publish, I cannot see the experience (a different text should appear). Not even the default would appear.

enter image description here

Few observations:

  1. On Author i can see the Audience traits under /etc/segmentation/contexthub/my-audience but the same is not there on Publish instance. I'm assuming this will be published along with the page, but is not happening.
  2. If the logged-in user does not have permission to /content/campaigns, then i see this error in the logs. If i give permissions then i do not see. Can i assume the component is loading?

    2017 03:01:22.427 *WARN* [192.150.10.207 [1498374082395] GET /content/brand/en-us/emp.html HTTP/1.1] com.day.cq.personalization.impl.AreaServiceImpl Area at /content/campaigns/ups/master not found or not accessible.
    
  3. If we look at the page source, we see the below. "campaignName" is empty?

    <div class="target parbase">
        <script type="text/javascript">
            if (window.ContextHub && ContextHub.SegmentEngine) {
                ContextHubJQ(function() {
                    ContextHub.SegmentEngine.PageInteraction.Teaser({
                        locationId: '_content_brand_en-us_comms_jcr_content_searchpar_title_631229628',
                        variants: [{"path":"/content/brand/en-us/comms/default","name":"default","title":"Default","campaignName":"","thumbnail":"/content/brand/en-us/comms.thumb.png","url":"/content/brand/en-us/comms/_jcr_content/searchpar/title_631229628.default.html","tags":[]}],
                        strategy: 'first',
                        trackingURL: null
                    });
                });
            }
        </script>
        <div id="_content_brand_en-us_comms_jcr_content_searchpar_title_631229628" class="campaign ">
          <noscript><div class="default title">
          <div class="ups-title">
            <h1 class="title-text">Default Title</h1>
          </div>
         </div>
         </noscript>
    </div>
    
  4. We are enabling the below url's through Dispatcher.

    /0024 { /type "allow" /url "/etc/segmentation.segment.js" }
    /0025 { /type "allow" /url "/etc/clientcontext*" }
    /0026 { /type "allow" /url "/libs/cq/personalization/components/clickstreamcloud/content/config.json" }
    /0027 { /type "allow" /url "/libs/wcm/stats/tracker.js" }
    /0028 { /type "allow" /url "/libs/cq/personalization/*" }
    /0062 { /type "allow" /glob "* /libs/cq/personalization/*" }  # enable personalization
    

What am i missing?

Upvotes: 1

Views: 1709

Answers (1)

Suren Konathala
Suren Konathala

Reputation: 3597

Adding resolution here for reference:

The default experiences shows with the below changes:

  1. Changed the code from

    <sly data-sly-test="${!wcmmode.disabled}">
      <div data-sly-call="${clientLib.all @ categories='personalization.kernel'}" data-sly-unwrap></div>
      <div data-sly-resource="${'config' @ resourceType='cq/personalization/components/clientcontext_optimized/config'}" data-sly-unwrap></div>
      <div data-sly-resource="${'contexthub' @ resourceType='granite/contexthub/components/contexthub'}" data-sly-unwrap></div>
    </sly>
    <sly data-sly-test="${!wcmmode.disabled}">
      <div data-sly-include="/libs/cq/cloudserviceconfigs/components/servicelibs/servicelibs.jsp" data-sly-unwrap></div>
      <meta data-sly-call="${clientLib.all @ categories='cq.apps.targeting'}" data-sly-unwrap></meta>
    </sly>
    

To just this:

<sly data-sly-resource="${'contexthub' @ resourceType='granite/contexthub/components/contexthub'}"/>
  1. Enabled the below urls in the Dispatcher's publish-farm.any

    /0036 { /type "allow" /url "/etc/cloudsettings*" }
    /0037 { /type "allow" /url "/etc/segmentation*" }
    

Also you can use this tool on Author instance to check the ContextHub settings: http://localhost:4502/etc/cloudsettings/default/contexthub.diagnostics.html

Upvotes: 1

Related Questions