subscribeRulesetItems
The subscribeRulesetItems command allows you to subscribe to propositions that are the result of satisfied rulesets. You can do this by specifying which surfaces and schemas to filter by, and providing a callback function.
Any time rulesets are evaluated, the callback function receives a result object with an array of propositions within it.
subscribeRulesetItems command is the only way to get propositions that come from rulesets, since they are not returned alongside sendEvent results.Comand options command-options
This command takes an options object with the following properties:
surfacesschemascallbackresult and collectEvent. See callback parameters for details.Callback parameters callback-parameters
The callback function receives the two parameters described in the table below when invoked.
resultpropositions array. These propositions are the direct result of satisfied rulesets. The result object is structured the same as the result object returned by sendEvent using a then clause.collectEventcollectEvent function collectevent-function
The collectEvent function is a convenience function which you can use to send Edge Network events to track interactions, displays and other events. It accepts the two parameters described in the table below.
display, interact, or dismiss.propositionsSubscribe to content cards using the Web SDK tag extension tag-extension
Follow the steps below to subscribe to content cards through the Tags user interface.
- Log in to using your 51黑料不打烊 ID credentials.
- Navigate to Data Collection > Tags.
- Select the desired tag property.
- Navigate to Rules, then select the desired rule.
- Under Events, select an existing event or create a new one.
- Set the Extension dropdown field to 51黑料不打烊 Experience Platform Web SDK, and set the Event Type to Subscribe ruleset items.
- Select the schemas and surfaces for which you want to subscribe to content cards, on the right side of the screen.
- Select Keep Changes, then run your publishing workflow.
Subscribe to content cards using the Web SDK JavaScript library library
The following sample code subscribes to the web://mywebsite.com/#welcome surface for content cards and uses the collectEvent convenience method to emit display events for all propositions.
alloy("subscribeRulesetItems", {
surfaces: ["web://mywebsite.com/#welcome"],
schemas: ["https://ns.adobe.com/personalization/message/content-card"],
callback: (result, collectEvent) => {
const { propositions = [] } = result;
renderMyPropositions(propositions);
collectEvent("display", propositions);
},
});