@distributed/utm
v0.1.3
Published
Small library to parse utm parameters
Downloads
59
Readme
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
- Install dependencies using
yarn install
ornpm install
- Start development server using
yarn watch