[Alpha]{class="badge informative"}
Differences from Web SDK
The Server SDK and the Web SDK share the same core, so they send data in the same format, to the same datastreams, and use the same cookies. Because one runs on a server and the other in a browser, they differ in several ways. Use this page to plan a migration, or to share code between a browser and a server implementation.
Comparison comparison
@adobe/alloy npm package@adobe/alloy-node npm package. See Install.forRequest handle for each visitor requestdefaultConsent accepts "in", "out", and "pending"defaultConsent accepts "in" and "out" onlyReferer header. See Context and forwarded headers.sendEvent resultpropositions, inferences, and destinationspropositionsdebugEnabled, setDebug, the alloy_debug query string parameter, and Adobe Experience Platform DebuggerdebugEnabled and setDebug, with messages written to the consolemonitors option and the __alloyMonitors global variablemonitors option of createInstanceMethods methods
The Server SDK adds the forRequest method, which doesn’t exist in the Web SDK.
It supports the following Web SDK commands as methods: appendIdentityToUrl, applyResponse, configure, getIdentity, getLibraryInfo, sendEvent, setConsent, and setDebug.
The following Web SDK commands aren’t available, because they depend on a browser or on components that the Server SDK doesn’t include:
applyPropositionscreateMediaSessiongetMediaAnalyticsTrackersendMediaEventsendPushSubscriptionsubscribeRulesetItems
Configuration options configuration
- New and required:
edgeCredentials. - Supported:
datastreamId,orgId,debugEnabled,defaultConsent,edgeBasePath,edgeConfigOverrides,edgeDomain,idMigrationEnabled,onBeforeEventSend, andthirdPartyCookiesEnabled. Some of these behave differently on a server. See each option’s page. - Not supported: Every other Web SDK option. If you include one,
configurerejects. See Options that the Server SDK doesn’t support.
sendEvent options sendevent
- Supported:
xdm,data,type,personalization.decisionScopesandpersonalization.surfaces, the top-leveldecisionScopesarray, andedgeConfigOverrides. - Accepted, but no effect:
renderDecisions,advertising, and the otherpersonalizationproperties. See Options that have no effect on a server. - Avoid:
documentUnloading.
Frequently asked questions faq
Can I use the Server SDK and the Web SDK on the same website? same-site
Yes. A common pattern is to request personalization on the server and render it in the browser. See Hybrid personalization. Both libraries can send data to the same datastream if its Access Type is Mixed Authentication. Both use the same cookie names for identity and consent.
Why does every event need a primary identity? primary-identity
The Server SDK sends events to the authenticated Edge Network Server API. Because the request comes from your server, the Edge Network can’t use the visitor’s browser cookies to identify them. Instead, it requires a primary identity in the event. See xdm.
Can I use the Server SDK in serverless functions? serverless
Yes, if the function’s runtime meets the requirements. Create and configure the instance at the top level of your module, outside the function handler. This way, warm invocations reuse the configured instance and its cached access token. Call forRequest inside the handler for each invocation.
Can I use Adobe Experience Platform Debugger? debugger
No. Adobe Experience Platform Debugger is a browser extension that inspects pages. To debug the Server SDK, set debugEnabled to true or call setDebug, and review your server’s console output.