https://github.com/segmentio/utm-params
parse and get all utm parameters
https://github.com/segmentio/utm-params
paused
Last synced: 8 months ago
JSON representation
parse and get all utm parameters
- Host: GitHub
- URL: https://github.com/segmentio/utm-params
- Owner: segmentio
- License: mit
- Created: 2014-02-05T08:34:26.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-10-05T18:30:46.000Z (over 2 years ago)
- Last Synced: 2025-06-30T17:32:05.610Z (12 months ago)
- Topics: paused
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 41
- Watchers: 36
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
[](https://circleci.com/gh/segmentio/utm-params)
[](https://codecov.io/gh/segmentio/utm-params)
Parse a URL, returning all UTM parameters.
## Installation
```sh
$ npm install @segment/utm-params
```
## API
### utm(querystring : string)
```js
utm('?utm_source=google&utm_medium=medium&utm_term=keyword&utm_content=some%20content&utm_campaign=some%20campaign&utm_test=other%20value');
```
```json
{
"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
```js
utm.strict('?utm_source=google&utm_medium=medium&utm_term=keyword&utm_content=some%20content&utm_campaign=some%20campaign&utm_test=other%20value');
```
```json
{
"source": "google",
"medium": "medium",
"term": "keyword",
"content": "some content",
"name": "some campaign"
}
```