Contexthub default | Community
Skip to main content
Level 2
April 20, 2026
Question

Contexthub default

  • April 20, 2026
  • 2 replies
  • 16 views

AEM as a Cloud Service is being used with ContextHub for personalization. After compilation, 32 JavaScript files(These files are already exists in code) are bundled into contexthub.kernel.js.
A requirement exists to create a custom default segment that differs from AEM’s OOTB DEFAULT segment.
The custom default segment was created using the following JavaScript:
JavaScript(function () {    'use strict';    var MyDefaultSegment = function () {        return true;    };    /* register function */    ContextHub.SegmentEngine.ScriptManager.register(        'Region-Default',        MyDefaultSegment    );})();Show more lines
Scoring configuration:

All region-specific segments (for example, Region-AA) are assigned a boost of 500
Region-Default is assigned a boost of 2 (minimum boost)

This works as expected when content is authored for all regions on the page.
The issue occurs when a region-specific segment (for example, Region-AA) is resolved but no content is authored for that segment. In this scenario:

ContextHub does not fall back to Region-Default
The page renders as empty
Inspecting the page shows that ContextHub.SegmentEngine.getResolvedSegments() returns both Region-AA and Region-Default

The requirement is that only Region-Default should be applied and rendered when no content exists for the resolved segment (Region-AA).

Thanks in advance for helping me resolve this issue.

    2 replies

    PGURUKRISHNA
    Level 5
    April 21, 2026

    Hey ​@vsps Use the "Default" Experience in the Personalization Component 

    Instead of creating a custom 

    Region-Default

     segment, use AEM's built-in Default experience in the Target/Personalization component. When authoring:

    • Add experiences for each region segment (Region-AA, Region-BB, etc.)

    • Author the fallback content in the Default experience (the one that always exists in the component)

    AEM will automatically render the Default experience when the winning segment's experience has no content. This is the OOTB intended pattern and requires no custom code .

    Pagidala GuruKrishna
    vspsAuthor
    Level 2
    April 21, 2026

    Thank you for your reply @PGURUKRISHNA
    When we use OOTB DEFAULT -
    In network tab  you get a call for experiencefragment.default.html with URL -
       https://myserver/folder1/page1/_jcr_content/root/responsivegrid/grid_copy/column-1/experiencefragment.default.html
    path resides on page. - Default behavior of context hub.

    However, when its a user defined segment the call changes to -
     https://myserver/content/campaigns/campaign1/master/test-offerhm/campaign-segment/page1-experiencefragment0/jcr:content/par.html

    path resides under /campaign.

    I need to make sure that call to default also goes to campaign folder and not to the page due to some client requirements.

    TarunKumar
    Community Advisor
    Community Advisor
    April 21, 2026

    Hi ​@vsps ,

    You can try to troubleshoot with below steps:
     

    • Verify Segment Priority (Boost Value):
      Each segment has a boost parameter used as a weighting factor 

      If multiple segments are valid, the engine selects the one with the higher number 

      Ensure the Region-Default does not have a lower priority than the empty region-specific segment if you intend it to be the primary fallback.

    • Check Resolved Segments:
      Use the ContextHub Diagnostics page or run ContextHub.SegmentEngine.getResolvedSegments() in the browser console 
      If both the specific region and the default region are listed, the engine has "resolved" the specific region successfully, which is why it isn't falling back . So try to increase the boost value.


      -Tarun
    vspsAuthor
    Level 2
    April 21, 2026

    Thank you ​@TarunKumar 

    Yes. Both Region-AA and Region-Default are resolved when I use zipcode for Region-AA.

    I wanted Region-AA to have preference over Region-Default thats why I gave Region-AA boost of 500 and Region-Default boost of 2.

    As per your suggestion I updated boost for  Region-Default. Still both  Region-AA and Region-Default are resolved.

    Wondering if there is any way I can check if content is loaded in Region-AA. If no content then I should return true for Region-Default.