Can I control the widget using javascript?
It is possible to activate a widget variant using Javascript in, for example, a button on the website. For example, you can display the 'request a quote' button on your website. When someone presses this button, the quote request form activates and opens automatically.
Other examples of how to use this are:
- Newsletter subscription
- Download whitepaper
- Get in touch
- Make an appointment
How do you do this?
Option 1: Add a javascript link to the button
1. Open your website builder and go to the button you want to add the link to. 2. Then add the appropriate link per widget. It is important to use the right key of your bot. ( Where can I find my Leadbot's key?) See below for the most common links.
Widget name in Dashboard | Javascript link |
javascript:Futy.activate('whatsapp', true) | |
Contact bot | javascript:Futy.activate('contact_leadbot', true) |
Option 2: Add an html link to the code
1. Open your website builder and go to the button you want to add the link to. 2. Then add the appropriate link per widget.
It is important here to use the correct name of your bot. You can find the name in your dashboard on the 'Leadbots' page. See below for the most common links.
Widget name in Dashboard | HTM link |
<a href="javascript:Futy.activate('whatsapp', true)">Open WhatsApp widget</a> | |
Contact bot | <a href="javascript:Futy.activate('contact_leadbot', true)">Open Leadbot</a> |
Activate widget via a parameter in the URL
It is possible to open a widget variant from a parameter in the URL. You can use this, for example, for an Adwords campaign. Chances are that a visitor from an Adwords campaign visits your website for the first time. With this functionality you can show this visitor a different variant than visitors who come to your website more often.
To activate a widget via a URL:
- Add this after your website URL: ?widget=whatsapp
- For example: https://futy.io/?widget=whatsapp
To open a widget from the URL
- First add above
- And also add the following: &open=1
- For example: https://futy.io/?widget=whatsapp&open=1
In the example, you can see the word "whatsapp. This is the key of the WhatsApp widget. Each Leadbot has its own personal key that you can call. Read here where to find the key of a Leadbot.
See below for some examples of keys and how to use them as links:
Widget name in Dashboard | Sample link |
https://voorbeeld.com/?widget=whatsapp | |
Contact bot | https://voorbeeld.com/?widget=contact_leadbot |