https://github.com/adamlc/go-utm
Utility to add Google UTM tags to a URL
https://github.com/adamlc/go-utm
Last synced: 7 days ago
JSON representation
Utility to add Google UTM tags to a URL
- Host: GitHub
- URL: https://github.com/adamlc/go-utm
- Owner: adamlc
- License: mit
- Created: 2018-07-09T14:11:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-30T11:10:19.000Z (over 7 years ago)
- Last Synced: 2025-01-05T19:42:11.694Z (over 1 year ago)
- Language: Go
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# UTM Tag Builder
[](https://travis-ci.org/adamlc/go-utm)
[](https://goreportcard.com/report/github.com/adamlc/go-utm) [](https://codecov.io/gh/adamlc/go-utm)
Use UTM Tag Builder to add Google utm tags to a URL.
## Installation
```bash
go get -u github.com/adamlc/go-utm
```
## Usage
```go
url, err := utm.BuildURL("https://test.com", utm.Config{
Source: "google",
Medium: "email",
Campaign: "Awesome Test"},
)
// https://test.com?utm_campaign=Awesome+Test&utm_medium=email&utm_source=google
```
#### func BuildURL
```go
func BuildURL(rawurl string, config Config) (string, error)
```
BuildURL adds UTM tags to the passed URL
#### type Config
```go
type Config struct {
Source string
Medium string
Campaign string
Content string
Term string
}
```
Config is used to configure UTM tags for a URL