Clear widget context using runtime JS
To clear contextual information from a widget:
-
Add a
scriptblock in theheadtag above the Discover beacon. -
Create an
updateContextobject and set the context you want to clear tonull. In the following code sample, thestore.idcontext is cleared.TipIf there are no other keys in
store, you can set the value ofstoretonull. In addition, if there are no other keys incontext, you can set the value ofcontexttonull. -
Push the
"updateContext"action and object(s) to Discover usingrfk.push().
Important
If an object within context only contains null values, that object is removed from context.
For specific examples of how to use the updateContext action to clear context, refer to Examples: Clearing page and widget context.