Skip to main content
For websites that support multiple languages, it’s essential that the displayed banners are synchronized with the active language of the page. InZone offers the setActiveLanguage function, which allows you to manually set the language for the displayed campaigns, ensuring that the ads are presented in the correct language based on the user’s preference.

Usage

You can call setActiveLanguage whenever the language changes on your site. For example, if your website uses internationalization (i18n) and the user switches languages, this function ensures that the banners also switch to the appropriate language
window.InZone.setActiveLanguage('en'); // Switches campaign banners to English
  • Parameter: The function accepts a string value representing the language code (e.g., ‘en’ for English, ‘fr’ for French).
  • Effect: Once the language is set, all campaigns will automatically refresh and display based on the selected language.

Example

If your website changes language dynamically (e.g., via i18next), you can call the function within the existing language-switching logic:
i18next.changeLanguage('en', () => {
  window.InZone.setActiveLanguage('en');
});
This ensures that users always see the correct localized campaigns, improving the relevancy and effectiveness of your campaigns.