How to Add a WhatsApp Chat Widget to Your Website
A floating WhatsApp chat button makes it incredibly easy for website visitors to contact you. Here is the complete guide to adding a custom WhatsApp widget to your website without slowing it down.
Why add a WhatsApp widget to your website?
Traditional email contact forms suffer from low response rates, and complex live chat widgets can slow down your page loading speed. A WhatsApp widget bridges this gap by providing visitors with a familiar, instant way to communicate. When a visitor clicks the widget, they are directed to the WhatsApp application on their phone or desktop, initiating a direct line of communication that you can nurture over time.
How to create a simple, custom WhatsApp button
To create a floating WhatsApp button, you only need a small snippet of HTML and CSS. This method is highly recommended because it has zero dependency on third-party scripts, keeping your site fast and SEO-friendly.
Step 1: The HTML code
Add the following HTML structure just before the closing </body> tag of your website template. Replace the phone number and pre-filled message with your own:
<a href="https://wa.me/15551234567?text=Hi!%20I%20have%20a%20question%20about%20your%20services."
class="whatsapp-widget" target="_blank" rel="noopener noreferrer">
<span>Chat with Us</span>
</a> Step 2: The CSS styling
Add this CSS code to your site's stylesheet to position the widget in the bottom-right corner of the screen and style it with the characteristic WhatsApp green:
.whatsapp-widget {
position: fixed;
bottom: 24px;
right: 24px;
background-color: #25D366;
color: #fff;
padding: 12px 20px;
border-radius: 50px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
display: flex;
align-items: center;
gap: 8px;
text-decoration: none;
font-weight: 600;
z-index: 9999;
transition: transform 0.2s ease;
}
.whatsapp-widget:hover {
transform: scale(1.05);
} Using third-party WhatsApp widget generators
If you prefer a pre-built widget with advanced customization, such as multiple agent profiles, greeting messages, or custom triggers, you can use widget generators like Elfsight, GetButton, or automated chat platforms. These tools provide a JavaScript snippet that you paste into your header, rendering a highly stylized and interactive chat widget instantly.
Best practices for website widgets
- Position Wisely: Place the button in the bottom-right corner, as this is the standard location where visitors look for support channels.
- Keep it Clean: Ensure the widget doesn't block critical screen elements like checkout buttons, navigation links, or cookie consent banners.
- Include a Call to Action: Use text like "Chat with us" or "Ask a question" instead of just a generic logo to encourage interaction.
- Monitor Analytics: Use UTM parameters in your WhatsApp link to track how many website conversions originate directly from your widget.
Generate your custom link first
Before building your website widget, generate a clean link with a pre-filled message using LinkWA.
Open LinkWA →