npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nadiamohamed/ai-referral-tracker

v0.1.0

Published

Detect and isolate AI-search referral traffic (ChatGPT, Perplexity, Gemini, Copilot, AI Overviews) from GA4 exports and server logs.

Readme


📖 Docs & full guide: How to track AI referral traffic in GA4 Built by Nadia Mohamed — SEO Engineer · Technical SEO + GEO for SaaS. Try the free companion tools at nadiamohamed.me/ai-tools.

Referrals from AI assistants are the fastest-growing traffic source almost nobody measures cleanly. In GA4 they're scattered across dozens of referral rows — chatgpt.com, perplexity.ai, gemini.google.com — with no built-in "AI search" channel to group them.

ai-referral-tracker does that grouping. Point it at a GA4 CSV export or a raw access log and it tells you exactly how much of your traffic came from AI search, broken down by engine.

Zero dependencies. The engine list lives in a single, editable JSON file so you can keep it current as new assistants ship.

Install

npx @nadiamohamed/ai-referral-tracker ga4-export.csv
# or
npm install -g @nadiamohamed/ai-referral-tracker

Usage

ai-referral <file|-> [options]

| Option | Description | | --- | --- | | -f, --format <fmt> | auto · ga4 · log (default auto) | | --json | Emit JSON instead of a table |

Read from stdin with -:

cat ga4-export.csv | ai-referral -

Example

$ ai-referral examples/ga4-export.csv

AI-search referral traffic

  ChatGPT      612  ████████████████████████ 45.7%
  Perplexity   344  █████████████ 25.7%
  Gemini       151  ██████ 11.3%
  Copilot       96  ████ 7.2%
  Claude        54  ██ 4.0%
  You.com       12  ▌ 0.9%

  1373 of 7657 sessions (17.9%) came from AI search.

Inputs it understands

GA4 CSV export — from Reports → Acquisition → Traffic acquisition, use the export button. The tool skips GA4's # comment preamble and auto-detects the Session source and Sessions columns (it also accepts Source / medium, First user source, etc.).

Server access logs — Common or Combined Log Format (nginx/Apache). The referrer field is read from each line and hits are grouped by referrer.

What counts as "AI search"

The full, versioned list is in data/ai-sources.json — ChatGPT, Perplexity, Gemini, Google AI Overviews, Copilot, Claude, You.com, Poe, Phind, Grok, DeepSeek, Mistral, Meta AI, and more. Each entry maps a friendly engine name to the hostname fragments that identify it. PRs welcome as new assistants launch — this file is meant to be a community-maintained reference.

Programmatic API

import { loadSources, classify, summarize } from '@nadiamohamed/ai-referral-tracker';

const engines = await loadSources();

classify('https://www.perplexity.ai/search', engines);
// -> { isAI: true, engine: 'Perplexity', vendor: 'Perplexity', matched: 'perplexity.ai' }

summarize(
  [ { source: 'chatgpt.com', sessions: 100 }, { source: 'google', sessions: 900 } ],
  engines
);
// -> { totalSessions: 1000, aiSessions: 100, aiShare: 0.1, engines: [...] }

Why not just a GA4 segment?

You can build one by hand — and then rebuild it every time a new assistant launches, in every property, forever. This keeps the source-of-truth list in version control, works on server logs GA4 never sees (bots that don't run JS), and drops straight into a reporting script or CI job.

Part of the GEO toolkit

Open-source tools I maintain for AI-search visibility:

Web-based versions (no install): AEO Analyzer, Keyword Clustering & more →

License

MIT © Nadia Mohamed — SEO Engineer, Technical SEO + GEO for SaaS & tech.