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

urldn-utm-validator

v1.0.0

Published

Validate, score, and fix UTM parameters in any URL. Catches broken tracking links before you ship a campaign. CLI + Node API.

Readme

urldn-utm-validator

Catch broken UTM parameters before you ship a campaign — not after you notice a hole in your analytics.

urldn-utm-validator checks any URL's utm_source, utm_medium, utm_campaign, utm_term, and utm_content parameters for the mistakes that quietly wreck attribution: missing required params, inconsistent casing, duplicate keys, unencoded spaces, and non-standard medium values. Use it as a CLI in your terminal or CI pipeline, or import it directly in Node.

npm version CI license

Why this exists

A single mistyped utm_mediumEmail instead of email — splits one channel into two rows in every dashboard downstream. Multiply that across a marketing team pasting links into Google Ads, Mailchimp, and social schedulers by hand, and campaign reporting quietly rots. This tool catches that class of bug in under a second, before the link goes out.

It's maintained by the team behind URLdn, a link intelligence platform that reads shortened-link analytics with an AI layer instead of raw dashboards — this validator is the free, standalone piece of that same problem space.

Install

npm install -g urldn-utm-validator

Or run it once without installing:

npx urldn-utm-validator "https://example.com?utm_source=newsletter&utm_medium=email&utm_campaign=q3-launch"

CLI usage

utm-check "https://example.com?utm_source=Newsletter&utm_medium=email&utm_campaign=spring sale"
URL:  https://example.com?utm_source=Newsletter&utm_medium=email&utm_campaign=spring sale
Score: 65/100

! [utm_source] "utm_source=Newsletter" contains uppercase letters. Analytics tools
  treat casing as distinct values, splitting one channel into two rows.
! [utm_campaign] "utm_campaign=spring sale" contains a raw space. Use hyphens
  instead, e.g. "spring-sale" not "spring sale".

Pipe a URL in instead of passing it as an argument:

echo "https://example.com?utm_source=fb" | utm-check

Machine-readable output for scripts and CI:

utm-check "https://example.com" --json

Fail CI on warnings too, not just hard errors:

utm-check "$URL" --strict

Options

| Flag | Description | |---|---| | --json | Print a machine-readable JSON report instead of formatted text | | --strict | Exit non-zero on warnings, not only on errors | | -h, --help | Show usage |

Exit code is 0 when the URL has no errors, 1 otherwise — safe to drop into a pre-commit hook or CI step that validates campaign links before a marketing PR merges.

Node API

import { validateUtm } from "urldn-utm-validator";

const result = validateUtm(
  "https://example.com?utm_source=Newsletter&utm_medium=email&utm_campaign=spring sale"
);

console.log(result.score);  // 65
console.log(result.valid);  // true (no hard errors, only warnings)
console.log(result.issues); // array of { level, param, message }
console.log(result.params); // parsed utm_source / utm_medium / utm_campaign / utm_term / utm_content

validateUtm(url: string): ValidationResult

interface ValidationResult {
  url: string;
  valid: boolean;      // false if any "error"-level issue is present
  score: number;        // 0-100 quality score
  params: UtmParams;     // the five parsed UTM values, or null if absent
  issues: UtmIssue[];   // level: "error" | "warning" | "info"
}

What it checks

  • Required params — flags a missing utm_source, utm_medium, or utm_campaign
  • Duplicate params — same key appearing twice in the query string
  • Casing consistency — uppercase letters that fragment reporting (Facebook vs facebook)
  • Unencoded spaces — raw spaces or + in a value instead of hyphens
  • Non-standard medium — soft warning when utm_medium doesn't match common values (cpc, email, social, organic, referral, affiliate, display, sms, newsletter, ...)
  • Domain-as-source — flags utm_source values that look like a full domain instead of a short label

This is a linter, not a spec enforcer — the "info"-level checks are suggestions, not failures, since UTM conventions vary by team.

Related

If you're shortening the links you're tagging, URLdn pairs a short link with an AI analyst that reads your click data directly and answers questions about it in plain English — built for teams without a dedicated data analyst on staff.

Contributing

Issues and PRs welcome. Keep the dependency footprint minimal — this package intentionally has one runtime dependency (picocolors) and no build framework beyond tsc.

git clone https://github.com/urldn/urldn-utm-validator.git
cd urldn-utm-validator
npm install
npm run build
node dist/cli.js "https://example.com?utm_source=test&utm_medium=cpc&utm_campaign=test"

License

MIT © URLdn