[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

Area
Web SDK
Server SDK
Where it runs
The visitor’s browser
Your server, in Node.js or another server-side JavaScript runtime. See Runtime support.
Installation
Tag extension, JavaScript library, or the @adobe/alloy npm package
The @adobe/alloy-node npm package. See Install.
How you call it
alloy("sendEvent", { ... })
alloy.sendEvent({ ... }). See Methods overview.
Instances
One per page load, serving one visitor
One per process, plus a forRequest handle for each visitor request
Authentication
None
Required. Events go to the authenticated Edge Network Server API. See Authentication.
Identity
Read from and written to browser cookies automatically
Read from and written to a cookie service that you provide. Every event needs a primary identity.
Consent
defaultConsent accepts "in", "out", and "pending"
defaultConsent accepts "in" and "out" only
Personalization
Requests, renders, and tracks the display of propositions
Requests propositions and returns them. Doesn’t render them or track their display.
Context data
Page, device, environment, place, and client hint details from the browser
Implementation details, the visitor’s forwarded request headers, and the page URL from the Referer header. See Context and forwarded headers.
sendEvent result
propositions, inferences, and destinations
propositions
Debugging
debugEnabled, setDebug, the alloy_debug query string parameter, and Adobe Experience Platform Debugger
debugEnabled and setDebug, with messages written to the console
Monitoring hooks
The monitors option and the __alloyMonitors global variable
The monitors option of createInstance

Methods 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:

  • applyPropositions
  • createMediaSession
  • getMediaAnalyticsTracker
  • sendMediaEvent
  • sendPushSubscription
  • subscribeRulesetItems

Configuration options configuration

sendEvent options sendevent

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.

recommendation-more-help
experience-platform-help-collection