Single-page apps

The messenger follows route changes in React, Vue, Svelte and any other single-page app. It listens to the History API, so most apps need no extra code, and update calls are never dropped.

Automatic route tracking

When the URL changes through pushState, replaceState or the back button, the SDK sends the new page context to Gripz. Page targeting, the AI agent and your teammates' details panel all see the page the visitor is on. The messenger stays open and keeps its place in the thread.

Gripz('boot', {
  workspaceId: 'tw_8f2k',
  routeTracking: 'auto'   // the default. Use 'manual' for hash routers
});

Set the route yourself

Hash routers and screens that change without a new URL can send the page context themselves. Turn on manual tracking, then call update after each navigation.

import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';

export function GripzRouteSync() {
  const location = useLocation();

  useEffect(() => {
    Gripz('update', {
      page: { path: location.pathname, title: document.title }
    });
  }, [location]);

  return null;
}

Update calls are never dropped

No cap per page
Calls to update are merged in the browser and sent at most once per second per page. However often your app navigates, the latest page context always arrives.
How update calls are handled
MergingUpdates sent within the same second become one request. The newest value of each field wins.
Fair useOnly a runaway loop reaches the ceiling of 1,000 updates per session per hour. The SDK then writes a warning with a link to this page in the browser console, and the messenger keeps working.
OfflineIf Gripz cannot be reached, commands wait in a queue for up to 5 minutes and are sent when the connection returns. Errors never throw into your page.

Sign-in and sign-out

A single-page app rarely reloads, so tell the messenger when the person changes. On a shared computer this keeps one person's conversations away from the next.

Sign-in and sign-out
WhenCallWhat happens
After sign-inidentifyPass the signed token. Earlier anonymous conversations in this browser are merged into the contact.
After sign-outshutdownClears the identity, the messenger's cookies, local storage and loaded conversations, then boots again as an anonymous visitor.
Missed sign-outNone neededIf a user ID that was identified before is missing on the next boot, the SDK resets on its own.