How to maximize the widget when a website loads

You can make your tawk.to chat widget open automatically when someone visits your website. This is a great way to grab your visitor’s attention and invite them to start a conversation.


In this article, we’ll show you how to set this up by combining the onBeforeLoad callback function and the maximize() action from our JavaScript API.

How to set it up

1. Get your chat widget code

Follow these steps to get your widget code:


1. Log in to your tawk.to account.


2. Select the correct property.

3. Click Administration on the top menu.

4. In the left menu, under Channels, select Chat Widget.

5. Under Widget Code, click Copy to Clipboard.

The Widget Code is copied to your clipboard, and you can paste it in your website’s HTML.
2. Add the maximize script
Paste the following code just before the closing </script> tag in your widget code:
3. Save and publish your changes

After updating your website code, publish or deploy your site. When visitors land on your page, the widget will open automatically.

Why use auto-maximize?

Enabling the widget to maximize on load can help you:

  • Get noticed – The chat window opens instantly, so visitors don’t miss it.

  • Encourage conversations – Prompt users to ask questions without needing to click first.

  • Increase engagement – Make it easier for customers to reach out and get help.

Important considerations

  • If a visitor minimizes the chat, it may maximize again when the page reloads.

  • This behavior cannot be controlled through the tawk.to dashboard. It must be configured manually with the code above.

  • If you’re also using other triggers (like greetings), both may run simultaneously.

Additional information

Explore the guides in our Help Center - JavaScript API category to learn about more ways to customize your chat widget.


If you have feedback about this article, or if you need more help:

Was this article helpful?

63 out of 98 liked this article

Still need help? Message Us