Change the widget based on the visitor’s language


Setting up widgets in multiple languages allows you to personalize the customer experience for each visitor on your website. JavaScript allows you to automatically load the widget based on the language set on the visitor’s device.

Only one widget at a time can function on the same website. The examples below load a single property/widget according to the criteria you choose. To use this method, you will need to remove the WordPress plugin, if it is being used.

NOTE: The instructions below can only be completed from a browser or the desktop apps. They cannot be completed in the mobile app.

Here’s what you need to do to get started:

1. Create a widget for each language

Related: Changing your widget's language

2. Find the property and widget IDs

Learn more here: Where can I find the property and widget IDs?

Modify your code to load a widget based on your visitor's language

The code snippet below automatically detects the visitor’s language set on their device and displays the appropriate widget based on the criteria set.

Learn more about adding multiple widgets to a website in this step-by-step guide: How to add multiple widgets to a website with JavaScript

If you need additional assistance setting up multiple widgets on your site, visit our Developer Platform or reach out in the chat. We are here to help 24x7. Need additional assistance? Reach out to our support team or schedule a call.

Was this article helpful?

89 out of 141 liked this article

Still need help? Message Us