Skip to main content
Welcome to Analytiq! Get set up in just a few minutes with our simple one-file setup. Analytiq is built on one core principle: Real Data Only. We don’t track automatic garbage or noisy intent metrics. We track exactly what you explicitly tell us to. By creating a single analytics.jsx file, Analytiq will:
  • Safely initialize your tracking across any React/Next.js environment
  • Tie perfectly into your own custom Authentication system
  • Save events when users go offline and retry later
  • Deduplicate accidentally repeated events

Step 1 — Create your account & project

  1. Go to analytiq-two.vercel.app/register and create your account.
  2. Click New Project, give it a name, and click Create.

Step 2 — Get your API Key

  1. Click on your project to open it
  2. Go to Settings in the left sidebar
  3. Scroll to Public API Key and click Reveal
  4. Copy your key (it looks like pk_live_xxxxxxxxxxxxxxxxxx)
API Key Security: Your Analytiq API Key (pk_live_...) is designed to be public. It is perfectly safe to expose it in your frontend code, environment variables, or bundled JavaScript.

Step 3 — Install the SDK

Open your terminal inside your project’s frontend folder and run:
npm install analytiq

Step 4 — The One-File Setup

You only need to set up Analytiq once in your entire app by creating a central tracking file. Create a file called analytics.jsx (or .tsx) anywhere in your project. We highly recommend placing it next to your other providers or in your src/ folder. This file acts as a bridge between Your Auth System and Our SDK.
Create src/analytics.jsx. Customize the useAuth() import to point to whatever authentication system you use (Firebase, Supabase, Custom JWT, etc).
src/analytics.jsx
import { Analytiq, identify, reset, track } from 'analytiq/react'
import { useEffect } from 'react'

// IMPORT YOUR APP'S AUTHENTICATION HOOK HERE
import { useAuth } from './context/AuthContext' 

export function AnalyticsProvider({ children }) {
  
  // Get the logged-in user from your system
  const { user } = useAuth() 

  useEffect(() => {
    if (user) {
       identify(user) // Tell the SDK who logged in
    } else {
       reset()            // Tell the SDK they logged out
    }
  }, [user])

  return (
    <>
      {/* Initialize the SDK once globally */}
      <Analytiq apiKey={import.meta.env.VITE_ANALYTIQ_KEY} />
      {children}
    </>
  )
}

// Export track so you can import it easily in other files
export { track }
Then, open your root App.jsx or main.jsx and wrap your app in the AnalyticsProvider you just created. Make sure it goes inside your Auth provider!
src/App.jsx
import { AnalyticsProvider } from './analytics.jsx'
import { AuthProvider } from './context/AuthContext.jsx'

function App() {
  return (
    <AuthProvider>
       <AnalyticsProvider>
          <Router>
             ...
          </Router>
       </AnalyticsProvider>
    </AuthProvider>
  )
}

Step 5 — Track Events!

Analytiq relies entirely on manual tracking. We don’t automatically guess what a user did; you explicitly tell the SDK when something important happens. Just import track from the analytics.jsx file you created in Step 4, and drop it anywhere you need it.
LandingPage.jsx
import { useEffect } from 'react';
import { track } from '../analytics.jsx';

export function LandingPage() {
  
  // Track Page Views explicitly
  useEffect(() => {
    track('Home_page_view')
  }, [])

  const handleCheckout = () => {
    // Track specific button clicks
    track('checkout_started', { 
      plan: 'pro',
      value: 49
    });
    // ... proceed to payment ...
  };

  return <button onClick={handleCheckout}>Upgrade Now</button>;
}
That’s it! If the AnalyticsProvider is active and your API key is correct, the event will instantly appear on your dashboard.

What’s next?

Track Custom Events

Learn more about adding properties to your track() calls.

All Framework Guides

Detailed, step-by-step setup guides for every framework.

API Reference

Full documentation for the useAnalytiq hook and core functions.