utm

package
v0.4.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

func AttachToRequest

func AttachToRequest(data UTMData, req *http.Request) *http.Request

func ContextTransfer

func ContextTransfer(in, out context.Context) context.Context

func ContextWithUTMData

func ContextWithUTMData(parentCtx context.Context, data UTMData) context.Context

func Middleware

func Middleware() func(http.Handler) http.Handler

Middleware attempts to attach utm data found in the request to the request context

Types

type RoundTripper

type RoundTripper struct {
	// contains filtered or unexported fields
}

func (*RoundTripper) RoundTrip

func (r *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

func (*RoundTripper) SetTransport

func (r *RoundTripper) SetTransport(tripper http.RoundTripper)

func (*RoundTripper) Transport

func (r *RoundTripper) Transport() http.RoundTripper

type UTMData

type UTMData struct {
	Source   string
	Medium   string
	Campaign string
	Term     string
	Content  string

	Client string // Unofficial pace utm parameter
}

https://en.wikipedia.org/wiki/UTM_parameters

func FromContext

func FromContext(ctx context.Context) (UTMData, bool)

func FromMap

func FromMap(m map[string]string) UTMData

func FromRequest

func FromRequest(req *http.Request) (UTMData, error)

func (UTMData) ToMap

func (d UTMData) ToMap() map[string]string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL