Analytics Setup
RankFlo includes built-in, cookieless analytics — no GDPR consent banner needed. One line of JavaScript gives you pageviews, traffic sources, device breakdown, country detection, AI referrer tracking, and custom events.
Install the tracker
Add this script tag to your website's <head> or before </body>:
<script
async
src="https://app.rankflo.io/tracker.js"
data-project-key="blg_YOUR_PROJECT_KEY"
></script>Replace blg_YOUR_PROJECT_KEY with your project API key from Dashboard → Projects → your project.
For self-hosted instances, replace app.rankflo.io with your own domain.
Next.js
// app/layout.tsx
import Script from "next/script";
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<Script
src="https://app.rankflo.io/tracker.js"
data-project-key="blg_YOUR_PROJECT_KEY"
strategy="afterInteractive"
/>
</body>
</html>
);
}Astro
<!-- src/layouts/Layout.astro -->
<html>
<body>
<slot />
<script
src="https://app.rankflo.io/tracker.js"
data-project-key="blg_YOUR_PROJECT_KEY"
async
></script>
</body>
</html>Plain HTML
<!-- Add before </body> -->
<script
src="https://app.rankflo.io/tracker.js"
data-project-key="blg_YOUR_PROJECT_KEY"
async
></script>What it tracks
The tracker automatically captures:
| Data point | How |
|---|---|
| Page views | Every page load and SPA navigation |
| Unique visitors | Anonymous ID stored in localStorage (not a cookie) |
| Sessions | Session ID in sessionStorage, resets on tab close |
| Referrer | document.referrer — where the visitor came from |
| Device type | Desktop, mobile, or tablet (from screen width) |
| Browser | Detected server-side from User-Agent |
| Operating system | Detected server-side from User-Agent |
| Country | IP geolocation (server-side, IP not stored) |
| UTM parameters | utm_source, utm_medium, utm_campaign, utm_term, utm_content |
| Session duration | Time between first and last event in a session |
| Language | navigator.language |
No cookies, no IP storage, no fingerprinting. The tracker uses localStorage for visitor IDs and sessionStorage for session IDs. Your visitor's IP is used server-side for country detection but is never stored in the database.
AI referrer tracking
RankFlo automatically detects traffic from AI platforms and shows them separately in the AI Referrers section of your analytics dashboard:
| Platform | Referrer domain |
|---|---|
| ChatGPT | chat.openai.com, chatgpt.com |
| Perplexity | perplexity.ai |
| Claude | claude.ai |
| Google Gemini | gemini.google.com |
| Microsoft Copilot | copilot.microsoft.com |
| Grok | grok.com |
| You.com | you.com |
| Phind | phind.com |
| Poe | poe.com |
No setup needed — if a visitor arrives from any of these platforms, it appears in your AI Referrers panel automatically.
Custom events
Track signups, button clicks, and other conversion events:
// Track a custom event
window.rankflo.track("signup", { plan: "pro" });
// Track a button click
document.getElementById("cta").addEventListener("click", () => {
window.rankflo.track("cta_click", { location: "hero" });
});Custom events appear in your analytics dashboard alongside pageviews.
SPA support
The tracker automatically detects client-side navigation (Next.js, Remix, Astro with view transitions) by listening for history.pushState and popstate events. No additional configuration needed.
Viewing analytics
Go to Analytics in the sidebar. You'll see:
- Overview — page views, unique visitors, sessions, engagement metrics
- Posts — top performing content with view counts
- Sources — referrers, AI referrers, UTM breakdown
- Locations — visitor countries
Use the date range picker (7d, 30d, 90d, 1yr) and project filter to narrow down the data.
The tracking snippet button at the top of the analytics page shows your project key and a ready-to-copy code snippet.
Self-hosted configuration
When self-hosting RankFlo, the tracker script is served from your own domain. Update the script URL to point to your instance:
<script
async
src="https://your-rankflo-domain.com/tracker.js"
data-project-key="blg_YOUR_PROJECT_KEY"
></script>All analytics data stays on your server — nothing is sent to third parties (except the optional IP geolocation lookup for country detection).