Skip to content

Latest commit

 

History

History
52 lines (39 loc) · 1.49 KB

README.md

File metadata and controls

52 lines (39 loc) · 1.49 KB

utm-params

Note
Segment has paused maintenance on this project, but may return it to an active status in the future. Issues and pull requests from external contributors are not being considered, although internal contributions may appear from time to time. The project remains available under its open source license for anyone to use.

CircleCI Codecov

Parse a URL, returning all UTM parameters.

Installation

$ npm install @segment/utm-params

API

utm(querystring : string)

utm('?utm_source=google&utm_medium=medium&utm_term=keyword&utm_content=some%20content&utm_campaign=some%20campaign&utm_test=other%20value');
{
  "source": "google",
  "medium": "medium",
  "term": "keyword",
  "content": "some content",
  "name": "some campaign",
  "test": "other value"
}

###utm.strict(querystring : string)

Will only return the 5 Google Analytics spec'd utm params

utm.strict('?utm_source=google&utm_medium=medium&utm_term=keyword&utm_content=some%20content&utm_campaign=some%20campaign&utm_test=other%20value');
{
  "source": "google",
  "medium": "medium",
  "term": "keyword",
  "content": "some content",
  "name": "some campaign"
}