- Help Centre
- Leadinfo Leadbot
- Editing a Leadbot
Can I control the widget using javascript?
It is possible to activate a widget variant using Javascript, for example in a button on the website. For example, you can show the 'request quote' button on your website. When someone presses this button, the quote request form activates and opens automatically.
Other examples of how you can use this are:
- Subscribe to newsletter
- Download whitepaper
- Please contact us
- Make an appointment
How do you do this?
Add a javascript link to the button
1. First create the Leadbot that you want to control via Javascript in your Leadinfo account and save the widget. Set the condition on a page where you want the widget. If you only want to use the widget behind a button, fill in a non-existent page.
After saving, a 'Widgetkey' is created that you can use in the JavaScript link.
2. Open your website builder and go to the button to which you want to add the link.
3. Add the following to the button:
javascript:leadinfo.widget.activate("Widgetkey", true);
In the place of 'Widgetkey' place the Key of your created Leadbot that you want to place behind the button.
The JavaScript code with the widget from the image below then becomes:
javascript:leadinfo.widget.activate("li_lgf_9694", true);
It is important to use the correct key for your bot.
Link: Where can I find the key for my Leadbot?
To call up a Leadbot via a link, you can use the following manual:
Leadbot activation by a link