</>
Back to Blog
Developer DocsIntegration

Install Grivo Chat Widget on Any Website

Add live chat to your website in under 2 minutes. One script tag - works with every framework. Copy the snippet for your stack and start talking to visitors instantly.

February 28, 2026
8 min read
Grivo Chat Widget
Lightweight • Fast • Customizable
<15KB gzipped
Works everywhere
1 line to install

Pure JavaScript, no dependencies, no build step. Just paste the snippet and your visitors can chat with you in real time.

Chat with us
We reply in minutes
Hi there! 👋 How can we help you?
I'd like to learn more about pricing
Of course! Let me share our plans...
Type a message...

Before You Start

  1. Sign up at grivo.io and log in to your dashboard.
  2. Go to Conversations → Create Chat Inbox.
  3. Copy your Inbox Token - you'll paste it in the code below.

Quick Start - Plain HTML

Works on any website. Paste this snippet right before the closing </body> tag:

index.htmlhtml
<!-- Add before closing </body> tag -->
<script>
  (function(g,r,i,v,o){g.grivo=g.grivo||function(){
  (g.grivo.q=g.grivo.q||[]).push(arguments)};
  o=r.createElement('script');o.async=1;
  o.src=v;r.head.appendChild(o);
  })(window,document,'grivo','https://grivo.io/widget/grivo-widget.js');

  grivo('init', { inboxToken: 'YOUR_INBOX_TOKEN' });
</script>

That's it! A green chat bubble will appear in the bottom-right corner of your page.

JavaScript Frameworks

Pick your framework below for a copy-paste snippet:

Using the App Router? Add the widget in your root layout.tsx so it loads on every page.

app/layout.tsxtsx
// app/layout.tsx  (App Router)
import Script from 'next/script';

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        {children}

        {/* Grivo Chat Widget */}
        <Script
          id="grivo-loader"
          strategy="afterInteractive"
          dangerouslySetInnerHTML={{
            __html: `
              (function(g,r,i,v,o){g.grivo=g.grivo||function(){
              (g.grivo.q=g.grivo.q||[]).push(arguments)};
              o=r.createElement('script');o.async=1;
              o.src=v;r.head.appendChild(o);
              })(window,document,'grivo','https://grivo.io/widget/grivo-widget.js');

              grivo('init', { inboxToken: 'YOUR_INBOX_TOKEN' });
            `,
          }}
        />
      </body>
    </html>
  );
}

PHP, Laravel & CMS Platforms

Add to your theme's footer.php or use the wp_footer hook.

footer.phpphp
<?php // header.php or footer.php (WordPress / PHP) ?>

<!-- Grivo Chat Widget -->
<script>
  (function(g,r,i,v,o){g.grivo=g.grivo||function(){
  (g.grivo.q=g.grivo.q||[]).push(arguments)};
  o=r.createElement('script');o.async=1;
  o.src=v;r.head.appendChild(o);
  })(window,document,'grivo','https://grivo.io/widget/grivo-widget.js');

  grivo('init', {
    inboxToken: '<?php echo esc_attr(get_option("grivo_inbox_token")); ?>'
  });
</script>

<?php
/**
 * Alternatively, add via WordPress hook:
 *
 * // In functions.php
 * function grivo_chat_widget() {
 *     $token = get_option('grivo_inbox_token', 'YOUR_INBOX_TOKEN');
 *     echo '<script>
 *       (function(g,r,i,v,o){g.grivo=g.grivo||function(){
 *       (g.grivo.q=g.grivo.q||[]).push(arguments)};
 *       o=r.createElement("script");o.async=1;
 *       o.src="https://grivo.io/widget/grivo-widget.js";
 *       r.head.appendChild(o);
 *       })(window,document,"grivo");
 *       grivo("init",{inboxToken:"' . esc_attr($token) . '"});
 *     </script>';
 * }
 * add_action('wp_footer', 'grivo_chat_widget');
 */
?>

JavaScript API Reference

Control the widget programmatically after initialization:

javascript
// Open the chat widget programmatically
grivo('open');

// Close the chat widget
grivo('close');

// Completely remove the widget from the page
grivo('destroy');
grivo('open')

Open the chat window.

grivo('close')

Minimize the chat window.

grivo('destroy')

Remove widget from page entirely.

Identifying Logged-In Users

When you pass email and name during init, the widget automatically skips the pre-chat form and links conversations to the user's contact record. This means returning users see their full chat history.

javascript
// Identify logged-in users to skip pre-chat form
// and link conversations to their account
grivo('init', {
  inboxToken: 'YOUR_INBOX_TOKEN',
  email: currentUser.email,      // User's email
  name: currentUser.displayName  // User's name
});

Customization Options

You can customize the widget directly from the Grivo dashboard - no code changes needed:

Widget Color

Match your brand - pick any hex color from the inbox settings.

Welcome Message

Set a greeting shown when visitors open the chat for the first time.

Pre-Chat Form

Collect name & email before chat starts. Disable for logged-in users.

Allowed Domains

Restrict widget to specific domains for security. Leave empty for all.

Troubleshooting

Widget bubble doesn't appear
Check that your Inbox Token is correct and the inbox is active. Open the browser console (F12) and look for [Grivo] error messages.
Widget appears but no messages send
Verify your API URL is correct. If self-hosting, ensure CORS allows your website domain on the API server.
Widget conflicts with other scripts
Grivo uses an isolated namespace (window.grivo). If you see z-index issues, the widget uses z-index 2147483000 - you may need to adjust other elements.
Pre-chat form keeps showing for returning visitors
The widget stores a token in localStorage. If your site clears localStorage on each visit, the visitor will be treated as new.

Ready to chat with your visitors?

Sign up for free, create an inbox, and paste the snippet. You'll be live in 2 minutes.