Legacy Dev Forum Posts

 View Only

Sign Up

Setting different JS SDK by country in a SSR website

  • 1.  Setting different JS SDK by country in a SSR website

    Posted 06-05-2025 18:04

    ThisIsMyLastResource | 2024-03-20 11:09:20 UTC | #1

    Currently, I have a Next.js SSR managing two countries.

    Each country is handled by folders rather than subdomain:

    • example.com/en-US
    • example.com/de-CH

    Now, for each country I have the a different environment and deploymentId, and when the user changes it's country from the locales dropdown, the chat should be the one on the selected country.

    The problem is, i don't reload the page, so the scripts of the selected country are not loaded.

    export default ({ children }) => {
      const { locale: lang } = useRouter();
      const country = useMemo(() => /* logic */, [lang]);
      useEffect(() => {
        (async () => {
          await setGenesysScript(genesysCredentialsBy[country]);
          setReady(true);
        })();
      }, [country]);
      return (
        <GenesysContext.Provider value={Genesys}> // injecting Genesys commands
          {children}
        </GenesysContext.Provider>
      );
    };

    have anyone here came across with something similar, or know how to achieve the expected behavior?


    system | 2024-04-20 11:10:07 UTC | #2

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 25308