The setBrowserLanguage API allows you to manually set the browser language for a visitor. This value is stored in localStorage. By setting the browser language explicitly, you can set it programmatically based on your application logic to be used by the survey for fetching questions based on the language set.
The language code to set (see Supported languages under Usage Notes). This value will be stored in localStorage.
Example
window.Wingify = window.Wingify || [];
// Set browser language to English
window.Wingify.push(['setBrowserLanguage', 'en']);
// Set browser language to Spanish
window.Wingify.push(['setBrowserLanguage', 'es']);
// Set browser language to French
window.Wingify.push(['setBrowserLanguage', 'fr']);
Use-cases
This will be used in surveys to show the question in the set browser language.
Notes
Add this API before SmartCode so the language preference is available from the initial survey execution on page load.
The language value is stored in localStorage with the key vwo_bL.
The value persists across browser sessions until explicitly changed or cleared.
Use a supported language code from the table below.
If no custom language is set, Wingify falls back to the default browser language value available in settings.
This API is intended for Survey language resolution.