/go-utm

Utility to add Google UTM tags to a URL

Primary LanguageGoMIT LicenseMIT

UTM Tag Builder

Travis Go Report Card codecov

Use UTM Tag Builder to add Google utm tags to a URL.

Installation

go get -u github.com/adamlc/go-utm

Usage

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

func BuildURL(rawurl string, config Config) (string, error)

BuildURL adds UTM tags to the passed URL

type Config

type Config struct {
	Source   string
	Medium   string
	Campaign string
	Content  string
	Term     string
}

Config is used to configure UTM tags for a URL