Home > How to load one widget or another depending on variables
(Last Updated On: November 10, 2020)
Most of our customers would choose which widget they want to install where, and install them accordingly on those pages. However, if you are running more of a complex operation, where you may want to detect some specific settings to determine which widgets to load, we can help with that! In that case you may want to load one widget or another depending on different variables you can expose from your website. This article will show you how to do this.
With this example code, we are determining the language on the address bar (language=fr or language-en), and loading one widget or another accordingly using the switchWidgetId function. We are also setting a default widget to be loaded in case the language in the address bar doesn’t match either. Once you determine the variable on your website, you will be able to use this template to load your widgets.
You can also contact us on [email protected] to discuss further or start a chat with us.
Published August 8, 2018