@distributed/utm
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

preview

Build Status npm version Dependencies npm downloads code style: prettier License: MIT

Small library to parse utm parameters.

Install

With yarn:

yarn add @distributed/utm

With npm:

npm install @distributed/utm

Usage

import { utm } from '@distributed/utm';

// location.search => ?utm_source=google&utm_campaign=campaignName&utm_medium=medium&utm_content=content&utm_term=term
const utms = utm(location.search);

console.table(utms);

/* =>
{
  "utm_source": "google",
  "utm_campaign": "campaignName",
  "utm_medium": "medium",
  "utm_content": "content",
  "utm_term": "term"
}
/*

Try it live

curl "https://utm.distributed.sh/?utm_source=google&utm_campaign=campaignName&utm_medium=medium&utm_content=content&utm_term=term"

# =>
# {
#   "utm_source": "google",
#   "utm_campaign": "campaignName",
#   "utm_medium": "medium",
#   "utm_content": "content",
#   "utm_term": "term"
# }

Development

  1. Install dependencies using yarn install or npm install
  2. Start development server using yarn watch

📑 License

MIT License

Package Sidebar

Install

npm i @distributed/utm

Weekly Downloads

25

Version

0.1.3

License

MIT

Unpacked Size

7.07 kB

Total Files

7

Last publish

Collaborators

  • gomah