Next.js and single-page apps

Website

Track every page view in your single-page app

The same script tag works in React, Vue and Next.js apps. Page views keep counting as the app changes pages, and the chat stays in place while your framework redraws the screen.

What it does

  • Page views on every route

    Switch on Send a pageview automatically and each route change is recorded, with no router code.

  • Events from any component

    Send events such as a purchase from anywhere; ones fired before the script loads are kept and sent.

  • Signed-in users recognised

    Your server signs who is logged in, so the visitor's earlier activity joins their customer profile.

How to connect

  1. 1

    Open Setup › Apps › Website chat, create the widget keys and add your app's addresses, your local one included.

  2. 2

    Put the snippet in index.html, or follow the Next.js example in the developer docs.

  3. 3

    Switch on Send a pageview automatically in the Events section of Website chat.

FAQs

Will the chat break when React re-renders?

No. The chat bubble sits outside your app's root, so re-renders leave it alone. Keep the search bar out of your components.

Is there a package to install?

No. The script loads from your workspace, so there is nothing to add to your build.

Missing an integration? Ask us, or connect it yourself.

Launch offer: every plan is free for 3 months