Query the page context
-
Complete the SDK quick start.
In the quick start, you make your first query by running
client.query("application.context").
If your app uses any of the SitecoreAI Page builder extension points, you can query the page context to retrieve details about the current page and site.
To query the page context:
-
In the SDK initialization code where you run the
useMarketplaceClienthook, in the Effect Hook, below the"application.context"query, create a new query, then save your changes: -
In the SitecoreAI Page builder, open your web browser's console, refresh the page, then open your Marketplace app.
-
In the console, find the log for
Success retrieving pages.contextand inspect the object. The object contains all the details about the current page and site.
This query also lets you subscribe to page events.