Skip to content

Next.js

Rewrites in next.config.ts, no extra server.

  1. Add the rewrites to next.config.ts

    Works the same on Vercel, on your own Node, or in Docker.

    // next.config.ts
    import type { NextConfig } from "next";
    
    const nextConfig: NextConfig = {
      async rewrites() {
        return [
          { source: "/js/llave.js", destination: "https://pisi.to/js/llave.js" },
          { source: "/api/event", destination: "https://pisi.to/api/event" },
        ];
      },
    };
    
    export default nextConfig;
    ts
  2. Point the Script at your domain

    The same component as the Next guide, with src and data-api on your domain.

    <Script
      defer
      data-api="/api/event"
      data-domain="example.com"
      src="/js/llave.js"
      strategy="afterInteractive"
    />
    tsx

Check that it works

Open your site in a new tab and watch the dashboard: you should show up under "home right now" in under ten seconds. If you do not, run through the onboarding checklist.