Documentation

Everything you need to integrate AxiaStats analytics into your website or application.

Quick Start

Adding AxiaStats to your site takes less than a minute. Just paste the tracking script into your HTML.

Step 1 — Add the Script

Paste this snippet in the <head> of every page you want to track:

<script defer data-website-id="YOUR_WEBSITE_ID" src="https://axiastats.com/js/ax.js"></script>
Tip: Replace YOUR_WEBSITE_ID with your actual website ID from the dashboard. The script is only ~2 KB gzipped.

Step 2 — Verify Installation

After adding the script, visit your website and open the browser console. You should see a network request to axiastats.com/api/collect.

Return to your AxiaStats dashboard and you should see data appearing within a few seconds.

Tracking Functions

axia.track()

Send a custom event from anywhere in your code:

// Track a button click
axia.track('signup-click');

// Track an event with data
axia.track('purchase', { plan: 'pro', amount: 29 });

// Track page views manually (SPA routing)
axia.track('pageview', { url: '/dashboard/reports' });

axia.identify()

Identify users for more detailed analytics:

// After user logs in
axia.identify({
  userId: 'user_12345',
  email: 'user@example.com',
  plan: 'pro'
});

Single Page Applications

For React, Vue, or other SPAs, use the data-auto-track="false" attribute and trigger pageviews manually:

<!-- In your HTML head -->
<script defer data-auto-track="false" data-website-id="YOUR_ID" src="https://axiastats.com/js/ax.js"></script>

Then in your router (React example):

// React Router v6
useEffect(() => {
  window.axia.track('pageview', { url: location.pathname });
}, [location]);

API Access

Query your analytics data programmatically using the REST API. All endpoints require an API key passed in the X-API-Key header.

Get Website Stats

GET /api/websites/{websiteId}/stats
Headers: X-API-Key: your-api-key

// Response
{
  "pageviews": { "value": 1250, "change": 12.3 },
  "visitors": { "value": 892, "change": 8.1 },
  "bounceRate": { "value": 34, "change": -2.4 },
  "avgSession": { "value": 145, "change": 5.2 }
}

Get Time Series

GET /api/websites/{websiteId}/pageviews?startAt=...&endAt=...&unit=day
Headers: X-API-Key: your-api-key

Privacy & Compliance