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

@e10/referrer-parser

v0.1.12

Published

Simple library for parsing referrer URLs

Downloads

13

Readme

Referrer Parser

A simple library for parsing referrer URLs to identify their source and medium.

Installation

npm install @e10/referrer-parser
# or
yarn add @e10/referrer-parser

Usage

Basic Usage

const { parse } = require('@e10/referrer-parser');

// Parse a referrer URL
const result = parse('https://www.google.com/search?q=luinq+cms');
console.log(result);
// {
//   referrerSource: 'Google',
//   referrerMedium: 'search',
//   referrerUrl: 'www.google.com'
// }

With Site Configuration

const { parse } = require('@e10/referrer-parser');

// Parse with site configuration to detect internal traffic
const result = parse(
  'https://example.com/blog?utm_source=newsletter&utm_medium=email',
  { 
    siteUrl: 'https://example.com',
    adminUrl: 'https://example.com/luinq'
  }
);

Using the ReferrerParser Class

For more advanced usage, you can use the ReferrerParser class directly:

const { ReferrerParser } = require('@e10/referrer-parser');

// Create a parser instance
const parser = new ReferrerParser({
  siteUrl: 'https://example.com',
  adminUrl: 'https://example.com/luinq'
});

// Parse multiple URLs with the same configuration
const result1 = parser.parse('https://www.google.com/search?q=luinq+cms');
const result2 = parser.parse('https://twitter.com/luinqcms');

Features

  • Identifies sources and mediums from known referrers
  • Handles special cases for Luinq Explore and Luinq Newsletters
  • Detects UTM parameters
  • Works with or without site/admin URL configuration
  • TypeScript support

TypeScript Support

This package is fully written in TypeScript and provides its own type definitions.

import { parse, ReferrerParser, ReferrerData, ParserOptions } from '@e10/referrer-parser';

// Parse a referrer URL with type safety
const result: ReferrerData = parse('https://www.google.com/search?q=luinq+cms');
console.log(result.referrerSource);  // 'Google'
console.log(result.referrerMedium);  // 'search'
console.log(result.referrerUrl);     // 'www.google.com'

// Configure the parser with typed options
const options: ParserOptions = {
  siteUrl: 'https://example.com',
  adminUrl: 'https://example.com/luinq'
};

// Create a parser instance with TypeScript
const parser = new ReferrerParser(options);
const customResult = parser.parse('https://example.com/blog?utm_source=newsletter');

License

MIT

Testing

Run the tests with:

yarn test

This will run the test suite using Mocha and report on test coverage.