@gptrends/track
v1.4.0
Published
Lightweight GEO tracking SDK for Next.js applications.
Readme
@gptrends/track
Lightweight GEO tracking SDK for Next.js and Astro applications.
Installation
npm install @gptrends/trackUsage
Next.js
import { GPTrendsTrackerNextJS } from '@gptrends/track/nextjs';
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
const gptrendsTrack = GPTrendsTrackerNextJS({
websiteKey: 'gptrends_secret_your_website_key_here'
});
export async function middleware(request: NextRequest) {
gptrendsTrack(request);
return NextResponse.next();
}
export const config = {
matcher: [
"/robots.txt",
"/sitemap.xml",
"/((?!api|_next/static|_next/image|.*\\.).*)",
],
};Astro
Coming soon!
Configuration
const gptrendsTrack = GPTrendsTrackerNextJS({
websiteKey: 'gptrends_secret_...'
});API
GPTrendsTrackerNextJS(config)
websiteKey(string, required) - Your GPTrends website key
GPTrendsTrackerAstro(config)
websiteKey(string, required) - Your GPTrends website key
Data Collected
- Page URL
- Referrer
- Website Key
- User Agent (not stored)
- IP Address (not stored)
License
CC-BY-NC-SA-4.0 - NonCommercial use only
