Small library to parse utm parameters.
With yarn:
yarn add @distributed/utm
With npm:
npm install @distributed/utm
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"
}
/*
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"
# }
- Install dependencies using
yarn install
ornpm install
- Start development server using
yarn watch