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

cross-platform-compressor

v1.0.3

Published

Library for compression and encoding of UTM parameters and tracking data

Downloads

10

Readme

Cross-Platform Compressor

A lightweight utility for compressing and encoding UTM parameters and tracking data.

Features

  • Compresses UTM parameters and tracking IDs (e.g., gclid, fbclid)
  • Supports any custom parameters beyond standard UTM parameters
  • Uses efficient key/value mapping for common values
  • Provides Base62 encoding for compact representation
  • Written in TypeScript with full type definitions
  • Works in both Node.js and browser environments

Installation

npm install cross-platform-compressor

or

yarn add cross-platform-compressor

Usage

Basic Usage

import { CrossPlatformCompressor } from "cross-platform-compressor";

// Example: Encode UTM parameters
const result = CrossPlatformCompressor.encode({
  utm_source: "google",
  utm_medium: "cpc",
  utm_campaign: "spring_sale",
  utm_content: "banner",
  utm_term: "discount",
  gclid: "Cj0KCQjw_12345678",
});

// Result will be a compressed string in base62 encoding
console.log(result);

Using Custom Parameters

import { CrossPlatformCompressor } from "cross-platform-compressor";

// Example: Encode UTM parameters along with custom parameters
const result = CrossPlatformCompressor.encode({
  utm_source: "google",
  utm_medium: "cpc",
  // Custom parameters - any key/value pairs are supported
  product_id: "12345",
  category: "electronics",
  referrer: "partner_site",
  visitor_type: "new",
});

// Result will include both standard and custom parameters
console.log(result);

TypeScript Usage

import {
  CrossPlatformCompressor,
  CompressionData,
} from "cross-platform-compressor";

const trackingData: CompressionData = {
  utm_source: "facebook",
  utm_medium: "social",
  utm_campaign: "holiday_special",
  // Any custom parameters
  region: "north_america",
  language: "en",
};

const encodedData = CrossPlatformCompressor.encode(trackingData);

Supported Parameters

The library supports the following tracking parameters as well as any custom parameters you need:

| Parameter | Description | | ------------ | ----------------------------------------------- | | utm_source | Identifies which site sent the traffic | | utm_medium | The marketing medium (e.g., cpc, banner, email) | | utm_campaign | The specific campaign name | | utm_content | Identifies what specifically was clicked | | utm_term | Identifies search terms | | utm_id | Campaign ID | | utm_cid | Campaign ID (alternative) | | gad_source | Google Ads source | | gclid | Google Click Identifier | | fbclid | Facebook Click Identifier | | msclkid | Microsoft Click Identifier | | * | Any custom parameter key/value pairs |

How It Works

  1. Parameter key mapping: Long parameter names are mapped to shorter ones (predefined parameters) or kept as-is (custom parameters)
  2. Value compression: Common values are mapped to shorter representations
  3. Number compression: Numbers are formatted with delimiters for better compression
  4. Data compression: The resulting JSON is compressed using GZIP
  5. Base62 encoding: Finally, the compressed data is encoded to a base62 string

Browser Compatibility

The library is compatible with all modern browsers and environments.

License

MIT