Configuring ContextHub in AEM Screens configuring-contexthub-in-aem-screens
This section emphasizes on creating and managing data-driven asset changes using a data store.
Key Terms key-terms
Before you get into the details of creating and managing inventory-driven channels in your AEM Screens project, learn some of the key terms to the different scenarios.
Brand – Your high-level project description.
Area – Your AEM Screens project name such as Digital Ad Signage
Activity – Defines the category rules such as Inventory-Driven, Weather-Driven, or Department Availability-Driven.
Audience – Defines the rule.
Segment – The version of an asset to play for the given rule. For example, if the temperature is below 50 degrees Fahrenheit, then the screen displays an image of a hot drink, otherwise a cold drink.
The following diagram provides a visual representation of how ContextHub configurations coincide with Activity, Audience, and Channels.
Preconditions preconditions
Before you start configuring ContextHub configurations for an AEM Screens project, set up Google Sheets (for demonstration purposes).
Step 1: Setting up a Data Store step-setting-up-a-data-store
You can set up the data store as a Local I/O event or as a local database event.
The following asset level data triggers example showcases a local database event. The event sets up a data store such as an Excel sheet that lets you use ContextHub configurations and segments path to the AEM Screens channel.
After you have set up the google
sheet correctly, as shown in the example below:
The following validation is what you view when you check your connection by entering the two values, *google sheet ID*
and *API key*
in the format below:
https://sheets.googleapis.com/v4/spreadsheets/<your sheet id>/values/Sheet1?key=<your API key>
Step 2: Setting up Store Configurations step-setting-store-configurations
-
Navigating to ContextHub
Navigate to your AEM instance and click the tools icon from the left sidebar. Click Sites > ContextHub, as shown in the figure below.
-
Creating a ContextHub Store Configuration
-
Navigate to the configuration container titled as screens.
-
Click Create > Create Configuration Container and enter the title as ContextHubDemo.
-
Navigate to ContextHubDemo > Create ContentHub Configuration and click Save.
note note NOTE After you click Save, you are in the ContextHub Configuration screen. -
From the ContextHub Configuration screen, click Create > ContentHub Store Configuration
note caution CAUTION As part of AEM 6.5 Feature Pack 4 or AEM 6.4 Feature Pack 8, customers should update /conf/screens/settings/cloudsettings
tosling:Folder
.Follow the steps below: - Navigate to CRXDE Lite and then to
/conf/screens/settings/cloudsettings
. - Check if
cloudsettings jcr:primaryType
is insling:Folder
. If thejcr:primaryType
is not insling:folder
, proceed to the next steps. - Right-click
/conf/screens/settings
and create a node with name ascloudsettings1
and Type assling:Folder
and save the changes. - Move all the nodes under
/conf/screens/settings/cloudsettings
tocloudsettings1
. - Delete
cloudsettings
and save. - Rename
cloudsettings1
tocloudsettings
and save. - Observe that
/conf/screens/settings/cloudsettings
hasjcr:primaryType
assling:Folder
.
Follow these steps in Author and Publish before or after the upgrade. -
Enter the Title as Google Sheets, Store Name as
googlesheets
, and Store Type as contexthub.generic-jsonp
and click Next.note caution CAUTION If you are using Adobe Experience Manager (AEM) 6.4, enter the Configuration Title as googlesheets
and the Store Type as contexthub.generic-jsonp
. -
Enter your specific json configuration. For example, you can use the following json for demo purposes and click Save. You see the store configuration titled as Google Sheets in ContextHub configuration.
note important IMPORTANT Make sure to replace the code with your *<Sheet ID>*
and*<API Key>*
, that you fetched while setting up the Google Sheets.code language-none { "service": { "host": "sheets.googleapis.com", "port": 80, "path": "/v4/spreadsheets/<your google sheets id>/values/Sheet1", "jsonp": false, "secure": true, "params": { "key": "<your Google API key>" } }, "pollInterval": 10000 }
note note NOTE In the above sample code, pollInterval defines the frequency at which the values are refreshed (in milliseconds). Replace the code with your *<Sheet ID>*
and*<API Key>*
, that you fetched while setting up the Google Sheets.note caution CAUTION If you create your Google Sheets to store configurations outside of the global folder (for example, in your own project folder), then targeting does not work out-of-the-box.
-
-
Setting up Store Segmentation
-
Navigate to ContentHub Store Configuration and create another store configuration in the AEM Screens configuration container and set the Title as segmentation-contexthub, Store Name as segmentation and Store Type as aem.segmentation.
-
Click Next and then Save.
note note NOTE Skip the process of defining the json and leave it as blank.
-
Step 3: Setting Up Segments in Audience setting-up-audience
-
Creating Segments in Audiences
-
Navigate from your AEM instance to Personalization > Audiences > screens.
-
Click Create > Create ContextHub Segment. The New ContextHub Segment dialog box opens.
-
Enter the Title as
**Higherthan50**
and click Create. Similarly, create another segment titled as**Lowerthan50**
. -
Click the segment
**Higherthan50**
and click Properties from the action bar.
-
Click the Personalization tab from the Segment Properties. Set the ContextHub Path to
/conf/screens/settings/cloudsettings/ContextHubDemo/contexthub configurations
and Segments Path to/conf/screens/settings/wcm/segments
and click Save, as shown in the figure below.
- Similarly, set the ContextHub Path and Segments Path for
**Lowerthan50**
segment too.
-
Step 4: Setting Up Brand and Area setting-brand-area
Follow the steps below to create a brand in your activities and areas under the brand:
-
Creating a Brand in Activities
-
Navigate from your AEM instance to Personalization > Activities.
-
Click Create > Create Brand.
-
Click Brand from the Create Page wizard and click Next.
-
Enter the Title as ScreensBrand and click Create. Your brand is now created as shown below.
note caution CAUTION Known Issue:
To add an area, remove the primary from the URL, such ashttp://localhost:4502/libs/cq/personalization/touch-ui/content/v2/activities.html/content/campaigns/screensbrand/master
.
-
-
Creating an Area in your Brand
Follow the steps below to create an area in the brand:
-
Click Create and then Create Area.
-
Click Area from the Create Page wizard and click Next.
-
Enter the Title as ScreensValue and click Create.
An area is created in your brand.
-
Step 5: Creating the Segments in an Activity step-setting-up-audience-segmentation
After you have set up a data store and defined your activity (brand and area), follow the steps below to create segments in your activity.
-
Creating Segments in Activities
-
Navigate from your AEM instance to Personalization > Activities > ScreensBrand >ScreensValue.
-
Click Create > Create Activity. The Configure Activity Wizard opens.
-
Enter the Title as ValueCheck50 and Name as valuecheck50. Click the Targeting engine as ContextHub (AEM) from the drop-down and click Next.
-
Click Add Experience from the
**Configure Activity**
wizard. -
From the Audiences, click the
**Higherthan50**
and click Add Experience and enter the Title as**higherthan50**
Name as**higherthan50**
. Click Ok. -
From the Audiences, click the
**Lowerthan50**
and click Add Experience and enter the Title as**lowerthan50**
Name as**lowerthan50**
. Click Ok.
-
Click Next and then Save.
**ValueCheck50**
activity is now created and configured.
-
Step 5: Editing the Segments in Audiences editing-audience-segmentation
-
Editing the Segments
-
Navigate from your AEM instance to Personalization > Audiences > screens.
-
Click the segment
**Higherthan50**
, and click Edit from the action bar. -
Drag and drop the Comparison: Property - Value component to the editor.
-
Click the wrench icon so you can open the Comparing a property with value dialog box.
-
Click googlesheets/value/1/0 from the drop-down in Property name.
note note NOTE The googlesheets/value/1/0 refers to row 2 and column as populated in google
sheets in the figure below: -
Click the Operator as greater-than from the drop-down menu.
-
Enter the Value as 70.
note note NOTE The AEM validates your data from the Google Sheet by showing your segment as green.
Similarly, edit the property values to
**Lowerthan50**
.-
Drag and drop the Comparison: Property - Value component to the editor.
-
Click the wrench icon.
-
In the Comparing a property with value dialog box, click googlesheets/value/1/0 from the drop-down in Property name.
-
Click the Operator as less-than from the drop-down menu.
-
Enter the Value as 50.
-
Enabling Targeting in Channels step-enabling-targeting-in-channels
Follow the steps below to enable targeting in your channels.
-
Navigate to one of the AEM Screens channels. The following steps demonstrate how to enable targeting by using DataDrivenChannel created in an AEM Screens channel.
-
Click the channel TargetChannel and click Properties from the action bar.
-
Click the Personalization tab so you can set up the ContextHub configurations.
-
Set the ContextHub Path to
/conf/screens/settings/wcm/segments
and Segments Path to/conf/screens/settings/wcm/segments
. -
Set brand to ScreensBrand from the dropdown and Set Area Reference to ScreensValue.
-
Click Save & Close.
note note NOTE Use the ContextHub and the Segments path, where you initially saved your ContextHub configurations and segments. -
Navigate and click the TargetChannel channel and click Edit from the action bar.
note note NOTE If you have set up everything correctly, you see the Targeting option in the drop-down from the editor, as shown in the figure below.
-
Learn More: Example Use Cases learn-more-example-use-cases
After you have configured ContextHub for your AEM Screens project, you can follow the different Use Cases to understand how data triggered assets plays a vital role in different industries: