Skip to main content
Skip table of contents

Context search mode options

Overview

This topic reviews the configuration of Realtime Layout and Contexts as well as how the different context search modes work based on the configuration of contexts within the Realtime Layouts.

The following section is a reference to the rpiWebClient configuration property related to Realtime Decisions search mode. This is the initial reference point for the intent of this page, but the Smart Asset Results API will also be reviewed to outline how this behavior is reflected in the API as well.

The Examples section contains various configurations of the rpiWebClient initialization and how they would interact with a Realtime layout.

Configuration property: realtimeContextSearchMode:

The Context SearchOperator(ContextSearchMode) controls how the ContextPath will be used to identify the smart assets to be evaluated:

  • IncludeSubcontexts(0) : Evaluate all smart assets that match the ContextPath or any sub context of the path provided

  • ExactPath(1) : Evaluate only smart assets that match the ContextPath

  • IncludeParentContexts(2) : Evaluate all smart assets that match the ContextPath or any parent within the context hierarchy

  • FirstParent(3) : Evaluate all smart assets that match the ContextPath, or if not found, the first match up the context hierarchy

Examples

This RTD Context Paths file contains the base HTML used in the examples.

HTML
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Jacek</title>
<style>#rpipage{top: 0px; right: 0px; bottom: 0px; left: 0px; width:800px; height: 100%; margin: auto;}</style>
<script type="text/javascript" src="C:\inetpub\wwwrpi\InteractionRealtimeAPI\rpiwebclient\rpiWebClient.config.js"></script>
<script type="text/javascript" src="C:\inetpub\wwwrpi\InteractionRealtimeAPI\rpiwebclient\rpiWebClient-6.6.js"></script>
</head>
<body>
<div id="Layer1">No Result 1</div>
<div id="Layer1-1">No Result 1-1</div>
<div id="Layer1-2">No Result 1-2</div>
<div id="Layer1-1-1">No Result 1-1-1</div>
<div id="Layer1-2-1">No Result 1-2-1</div>
<script type="text/javascript">
rpiWebClient.init({
  contexts: ["Layer1"],
  realtimeContextSearchMode: 0,
  debug:true,
  "clientId": "11111111-1111-1111-1111-111111111111",
  "serverUrl": "https://local.rphelios.net/interactionrealtimeapi",
  "enableLinkTracking": true
});
</script>
</div>
</body></html>

There are 5 divs in the file, each of which corresponds to one of the SmartAssets in this Realtime Layout:

Realtime Layout

The Smart Assets contain an inline text element of their name. When the rpiWebClient returns a Smart Asset, its name will appear in the output (e.g., Layer1-1-1). If it did not return a Smart Asset, the displayed text would be No Result 1-1-1.

Also note that the ContextPath in the context's parameter must always exactly match the Realtime Layout. Layer1 and Layer1/Layer1-2 are both valid, but Layer1-2 is not.

IncludeSubcontexts(0)

contexts: [“Layer1”]

contexts: [“Layer1/Layer1-2”]
contexts: [”Layer1”] - no match on rule for Layer1-1

ExactPath(1)

contexts: [“Layer1/Layer1-2”]
contexts: [“Layer1/Layer1-2”,”Layer1/Layer1-1/Layer1-1-1”]

IncludeParentContexts(2)

contexts: [“Layer1/Layer1-2”]
contexts: [“Layer1/Layer1-2”,”Layer1/Layer1-1/Layer1-1-1”]
contexts: [”Layer1/Layer1-1/Layer1-1-1”] - no match on rule for Layer1-1

FirstParent(3)

contexts: [“Layer1/Layer1-2”]

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.