Skip to main content

Background

The examples in the server side rendering guide for Amplitude Experiment have…

  1. a “server” deployment key for initialising the node SDK used to fetch initial variants, see https://www.docs.developers.amplitude.com/experiment/guides/server-side-rendering/#initialize-the-server-sdk
  1. a “client” deployment key for initialising the javascript SDK ExperimentClient with those initial variants, also used on the server. See first “if” branch here https://www.docs.developers.amplitude.com/experiment/guides/server-side-rendering/#initialize-the-client-sdk-on-render. The “client” deployment key matches that used to initialise the ExperimentClient in the browser in the second “if” branch.

However, the Amplitude Experiment Node SSR Demo app here https://github.com/amplitude/experiment-node-server/tree/main/packages/ssr-demo uses an identical “client” deployment key for all three. (https://github.com/amplitude/experiment-node-server/blob/main/packages/ssr-demo/lib/experiment.ts and https://github.com/amplitude/experiment-node-server/blob/main/packages/ssr-demo/pages/_app.tsx).

 

Questions

  1. What is the correct recommended approach?
    1. Single “client” deployment for both browser and server tiers of SSR, or separate “server” and “client” deployments?
    2. If separate deployments, should the “server” deployment key also be used to initialise the ExperimentClient used for SSR rendering?
       
  2. What would be the benefit of having separate “server” and “client” deployments at all? (I imagined something around flexibility around flags that only affect server rendering or something to do with local evaluation, but I couldn’t think of any concrete use case examples).
Be the first to reply!

Reply