ContextHub is a framework for storing, manipulating, and presenting context data. The ContextHub Javascript API enables you to access stores to create, update, and delete data as necessary. As such, ContextHub represents a data layer on your pages. This page describes how to add context hub to your AEM site pages.

Note:

We use the WKND reference site for this video and it is not part of AEM release. You can try these settings on your AEM site.

Add ContextHub to your pages to enable the ContextHub features and to link to the ContextHub Javascript libraries. The ContextHub Javascript API provides access to the context data that ContextHub manages. 

Adding ContextHub to a Page Component

To enable the ContextHub features and to link to the ContextHub Javascript libraries, include the contexthub component in the head section of your page. The JSP code for your page component resembles the following example:

 

<!--/* Include Context Hub */-->
<sly data-sly-resource="${'contexthub' @ resourceType='granite/contexthub/components/contexthub'}"/>
*/-->

Site Configuration and ContextHub Segments

ContextHub includes a segmentation engine that manages segments and determines which segments are resolved for the current context. Several segments are defined. You can use the Javascript API to determine resolved segments. Enable the ContextHub segments for your site under Configuration Browser.

Create Segments

Create AEM segments that act as rules for the teasers. That is, they define when content within a teaser appears on a web page. Content can then be specifically targeted to the visitor's needs and interests, depending on the segment(s) they match.

Assigning Cloud Configuration, Segment path and ContextHub path to your site

Assigning the Cloud configuration path, segmentation path and context hub path to your site root node so you can create a personalized experience for your audience. Using the context hub, you can manipulate the context data and test your resolved segments.

screen_shot_2018-09-19at85220am

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy