Installation

Detailed installation guides for every framework and platform.

Client-Side Analytics#

HTML / Static Sites#

Add the tracking script directly to your HTML:

<head>
  <script
    defer
    src="https://justanalytics.app/tracker.js"
    data-site-id="YOUR_SITE_ID"
  ></script>
</head>

Next.js (App Router)#

Add the script tag to your root layout:

// app/layout.tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        <script
          defer
          src="https://justanalytics.app/tracker.js"
          data-site-id="YOUR_SITE_ID"
        />
      </head>
      <body>{children}</body>
    </html>
  );
}

React (Vite / CRA)#

Add the script in your index.html:

<!-- public/index.html -->
<head>
  <script
    defer
    src="https://justanalytics.app/tracker.js"
    data-site-id="YOUR_SITE_ID"
  ></script>
</head>

Vue.js#

Add to your index.html or use a plugin:

<!-- index.html -->
<head>
  <script
    defer
    src="https://justanalytics.app/tracker.js"
    data-site-id="YOUR_SITE_ID"
  ></script>
</head>

WordPress#

Add the snippet to your theme's header.php or use a plugin that injects scripts into the <head> tag.

Server-Side SDK#

Node.js#

npm install @justanalyticsapp/node
# or
yarn add @justanalyticsapp/node
# or
pnpm add @justanalyticsapp/node
import JA from '@justanalyticsapp/node';

JA.init({
  siteId: 'YOUR_SITE_ID',
  apiKey: 'YOUR_API_KEY',
  serviceName: 'my-service',
  environment: process.env.NODE_ENV,
});

Framework Integrations#

The Node.js SDK provides built-in integrations for popular frameworks:

| Framework | Integration | Auto-Instrumented | |-----------|------------|-------------------| | Express.js | JA.expressMiddleware() | HTTP requests, routes | | Next.js | @justanalyticsapp/node/next | API routes, middleware, server components | | PostgreSQL | Auto-detected | Queries, transactions | | Redis | Auto-detected | Commands, pipelines |

Environment Variables#

We recommend storing your credentials in environment variables:

# .env
JUSTANALYTICS_SITE_ID=your_site_id
JUSTANALYTICS_API_KEY=ja_sk_your_api_key
JA.init({
  siteId: process.env.JUSTANALYTICS_SITE_ID!,
  apiKey: process.env.JUSTANALYTICS_API_KEY!,
  serviceName: 'my-service',
});

Verifying Installation#

After installing, visit your JustAnalytics dashboard. You should see:

  1. Real-time visitors appearing within seconds (for client-side)
  2. Traces in the Trace Explorer (for server-side SDK)
  3. Errors in the Error Tracking panel (if any occur)

If data doesn't appear within 60 seconds, check the browser console or server logs for any errors.