Adapters
Adapters provide environment-specific implementations for plugins. They handle the differences between browser and server environments, such as cookie management, request/response handling, and data fetching. In the analytics layer, adapters implement the AnalyticsAdapter interface, which extends the generic PluginAdapter from @sitecore-content-sdk/core.
See the following interface for the built-in AnalyticsAdapter as an example:
Adapters are passed into plugins at initialization time so that each plugin can remain environment‑agnostic while still performing environment‑specific tasks. In the below example of a browser initialization logic, analyticsPlugin will manage client IDs through methods getClientId and setClientId on the analyticsBrowserAdapter instead of directly modifying window or document objects: