I have been working in custom preference centre and one of the requirement is to translate the page based on the browser language. The difficulty here is detecting the browser language "Navigator.language" returns the browser language however its a client side function. The translations are managed through AMP Script, how can we get this language value passed to AMP Script?
- With GetUserLanguages SSJS function - but from initial testing this works only in Microsites, not on CloudPages
- Getting Accept-Language header with GetRequestHeader SSJS function - this will work for both Microsites and CloudPages
- With HTTPRequestHeader Ampscript function - same header as above
You can pass values from SSJS to Ampscript with SetValue