mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 08:06:52 +02:00
update vendored deps
This commit is contained in:
parent
7008e79c9c
commit
e56f9c8c56
22
vendor/github.com/jpillora/go-ogle-analytics/LICENSE
generated
vendored
Normal file
22
vendor/github.com/jpillora/go-ogle-analytics/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright © 2015 dev@jpillora.com, Google Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
81
vendor/github.com/jpillora/go-ogle-analytics/README.md
generated
vendored
Normal file
81
vendor/github.com/jpillora/go-ogle-analytics/README.md
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
## Go-ogle Analytics
|
||||
|
||||
Track and monitor your Go programs for free with Google Analytics
|
||||
|
||||
The `ga` package is essentially a Go wrapper around the [Google Analytics - Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/reference)
|
||||
|
||||
**Warning** This package is 95% generated from the [Parameter Reference](https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters) so it may contain bugs - please report them. GA allows "10 million hits per month per property" and will reject requests after that.
|
||||
|
||||
### Install
|
||||
|
||||
```
|
||||
go get -v github.com/jpillora/go-ogle-analytics
|
||||
```
|
||||
|
||||
### API
|
||||
|
||||
Create a new `client` and `Send()` a 'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception' or 'timing' event.
|
||||
|
||||
#### http://godoc.org/github.com/jpillora/go-ogle-analytics
|
||||
|
||||
### Quick Usage
|
||||
|
||||
1. Log into GA and create a new property and note its Tracker ID
|
||||
|
||||
1. Create a `ga-test.go` file
|
||||
|
||||
``` go
|
||||
package main
|
||||
|
||||
import "github.com/jpillora/go-ogle-analytics"
|
||||
|
||||
func main() {
|
||||
client, err := ga.NewClient("UA-XXXXXXXX-Y")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = client.Send(ga.NewEvent("Foo", "Bar").Label("Bazz"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
println("Event fired!")
|
||||
}
|
||||
```
|
||||
|
||||
1. In GA, go to Real-time > Events
|
||||
|
||||
1. Run `ga-test.go`
|
||||
|
||||
```
|
||||
$ go run ga-test.go
|
||||
Event fired!
|
||||
```
|
||||
|
||||
1. Watch as your event appears
|
||||
|
||||
![foo-ga](https://cloud.githubusercontent.com/assets/633843/5979585/023fc580-a8fd-11e4-803a-956610bcc2e2.png)
|
||||
|
||||
#### MIT License
|
||||
|
||||
Copyright © 2015 <dev@jpillora.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
76
vendor/github.com/jpillora/go-ogle-analytics/client.go
generated
vendored
Normal file
76
vendor/github.com/jpillora/go-ogle-analytics/client.go
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
//go:generate go run generate/protocol.go
|
||||
|
||||
package ga
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
var trackingIDMatcher = regexp.MustCompile(`^UA-\d+-\d+$`)
|
||||
|
||||
func NewClient(trackingID string) (*Client, error) {
|
||||
if !trackingIDMatcher.MatchString(trackingID) {
|
||||
return nil, fmt.Errorf("Invalid Tracking ID: %s", trackingID)
|
||||
}
|
||||
return &Client{
|
||||
UseTLS: true,
|
||||
HttpClient: http.DefaultClient,
|
||||
protocolVersion: "1",
|
||||
protocolVersionSet: true,
|
||||
trackingID: trackingID,
|
||||
clientID: "go-ga",
|
||||
clientIDSet: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
type hitType interface {
|
||||
addFields(url.Values) error
|
||||
}
|
||||
|
||||
func (c *Client) Send(h hitType) error {
|
||||
|
||||
cpy := c.Copy()
|
||||
|
||||
v := url.Values{}
|
||||
|
||||
cpy.setType(h)
|
||||
|
||||
err := cpy.addFields(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = h.addFields(v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
url := ""
|
||||
if cpy.UseTLS {
|
||||
url = "https://www.google-analytics.com/collect"
|
||||
} else {
|
||||
url = "http://ssl.google-analytics.com/collect"
|
||||
}
|
||||
|
||||
str := v.Encode()
|
||||
buf := bytes.NewBufferString(str)
|
||||
|
||||
resp, err := c.HttpClient.Post(url, "application/x-www-form-urlencoded", buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode/100 != 2 {
|
||||
return fmt.Errorf("Rejected by Google with code %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
// fmt.Printf("POST %s => %d\n", str, resp.StatusCode)
|
||||
|
||||
return nil
|
||||
}
|
19
vendor/github.com/jpillora/go-ogle-analytics/conv.go
generated
vendored
Normal file
19
vendor/github.com/jpillora/go-ogle-analytics/conv.go
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
package ga
|
||||
|
||||
import "fmt"
|
||||
|
||||
func bool2str(val bool) string {
|
||||
if val {
|
||||
return "1"
|
||||
} else {
|
||||
return "0"
|
||||
}
|
||||
}
|
||||
|
||||
func int2str(val int64) string {
|
||||
return fmt.Sprintf("%d", val)
|
||||
}
|
||||
|
||||
func float2str(val float64) string {
|
||||
return fmt.Sprintf("%.6f", val)
|
||||
}
|
1228
vendor/github.com/jpillora/go-ogle-analytics/type-client.go
generated
vendored
Normal file
1228
vendor/github.com/jpillora/go-ogle-analytics/type-client.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
58
vendor/github.com/jpillora/go-ogle-analytics/type-event.go
generated
vendored
Normal file
58
vendor/github.com/jpillora/go-ogle-analytics/type-event.go
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
package ga
|
||||
|
||||
import "net/url"
|
||||
|
||||
//WARNING: This file was generated. Do not edit.
|
||||
|
||||
//Event Hit Type
|
||||
type Event struct {
|
||||
category string
|
||||
action string
|
||||
label string
|
||||
labelSet bool
|
||||
value int64
|
||||
valueSet bool
|
||||
}
|
||||
|
||||
// NewEvent creates a new Event Hit Type.
|
||||
// Specifies the event category.
|
||||
// Specifies the event action.
|
||||
|
||||
func NewEvent(category string, action string) *Event {
|
||||
h := &Event{
|
||||
category: category,
|
||||
action: action,
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Event) addFields(v url.Values) error {
|
||||
v.Add("ec", h.category)
|
||||
v.Add("ea", h.action)
|
||||
if h.labelSet {
|
||||
v.Add("el", h.label)
|
||||
}
|
||||
if h.valueSet {
|
||||
v.Add("ev", int2str(h.value))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Specifies the event label.
|
||||
func (h *Event) Label(label string) *Event {
|
||||
h.label = label
|
||||
h.labelSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the event value. Values must be non-negative.
|
||||
func (h *Event) Value(value int64) *Event {
|
||||
h.value = value
|
||||
h.valueSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Event) Copy() *Event {
|
||||
c := *h
|
||||
return &c
|
||||
}
|
49
vendor/github.com/jpillora/go-ogle-analytics/type-exception.go
generated
vendored
Normal file
49
vendor/github.com/jpillora/go-ogle-analytics/type-exception.go
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
package ga
|
||||
|
||||
import "net/url"
|
||||
|
||||
//WARNING: This file was generated. Do not edit.
|
||||
|
||||
//Exception Hit Type
|
||||
type Exception struct {
|
||||
description string
|
||||
descriptionSet bool
|
||||
isExceptionFatal bool
|
||||
isExceptionFatalSet bool
|
||||
}
|
||||
|
||||
// NewException creates a new Exception Hit Type.
|
||||
|
||||
func NewException() *Exception {
|
||||
h := &Exception{}
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Exception) addFields(v url.Values) error {
|
||||
if h.descriptionSet {
|
||||
v.Add("exd", h.description)
|
||||
}
|
||||
if h.isExceptionFatalSet {
|
||||
v.Add("exf", bool2str(h.isExceptionFatal))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Specifies the description of an exception.
|
||||
func (h *Exception) Description(description string) *Exception {
|
||||
h.description = description
|
||||
h.descriptionSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies whether the exception was fatal.
|
||||
func (h *Exception) IsExceptionFatal(isExceptionFatal bool) *Exception {
|
||||
h.isExceptionFatal = isExceptionFatal
|
||||
h.isExceptionFatalSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Exception) Copy() *Exception {
|
||||
c := *h
|
||||
return &c
|
||||
}
|
98
vendor/github.com/jpillora/go-ogle-analytics/type-item.go
generated
vendored
Normal file
98
vendor/github.com/jpillora/go-ogle-analytics/type-item.go
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
package ga
|
||||
|
||||
import "net/url"
|
||||
|
||||
//WARNING: This file was generated. Do not edit.
|
||||
|
||||
//Item Hit Type
|
||||
type Item struct {
|
||||
iD string
|
||||
name string
|
||||
price float64
|
||||
priceSet bool
|
||||
quantity int64
|
||||
quantitySet bool
|
||||
code string
|
||||
codeSet bool
|
||||
category string
|
||||
categorySet bool
|
||||
currencyCode string
|
||||
currencyCodeSet bool
|
||||
}
|
||||
|
||||
// NewItem creates a new Item Hit Type.
|
||||
// A unique identifier for the transaction. This value should
|
||||
// be the same for both the Transaction hit and Items hits
|
||||
// associated to the particular transaction.
|
||||
// Specifies the item name.
|
||||
|
||||
func NewItem(iD string, name string) *Item {
|
||||
h := &Item{
|
||||
iD: iD,
|
||||
name: name,
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Item) addFields(v url.Values) error {
|
||||
v.Add("ti", h.iD)
|
||||
v.Add("in", h.name)
|
||||
if h.priceSet {
|
||||
v.Add("ip", float2str(h.price))
|
||||
}
|
||||
if h.quantitySet {
|
||||
v.Add("iq", int2str(h.quantity))
|
||||
}
|
||||
if h.codeSet {
|
||||
v.Add("ic", h.code)
|
||||
}
|
||||
if h.categorySet {
|
||||
v.Add("iv", h.category)
|
||||
}
|
||||
if h.currencyCodeSet {
|
||||
v.Add("cu", h.currencyCode)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Specifies the price for a single item / unit.
|
||||
func (h *Item) Price(price float64) *Item {
|
||||
h.price = price
|
||||
h.priceSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the number of items purchased.
|
||||
func (h *Item) Quantity(quantity int64) *Item {
|
||||
h.quantity = quantity
|
||||
h.quantitySet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the SKU or item code.
|
||||
func (h *Item) Code(code string) *Item {
|
||||
h.code = code
|
||||
h.codeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the category that the item belongs to.
|
||||
func (h *Item) Category(category string) *Item {
|
||||
h.category = category
|
||||
h.categorySet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// When present indicates the local currency for all transaction
|
||||
// currency values. Value should be a valid ISO 4217 currency
|
||||
// code.
|
||||
func (h *Item) CurrencyCode(currencyCode string) *Item {
|
||||
h.currencyCode = currencyCode
|
||||
h.currencyCodeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Item) Copy() *Item {
|
||||
c := *h
|
||||
return &c
|
||||
}
|
24
vendor/github.com/jpillora/go-ogle-analytics/type-pageview.go
generated
vendored
Normal file
24
vendor/github.com/jpillora/go-ogle-analytics/type-pageview.go
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
package ga
|
||||
|
||||
import "net/url"
|
||||
|
||||
//WARNING: This file was generated. Do not edit.
|
||||
|
||||
//Pageview Hit Type
|
||||
type Pageview struct {
|
||||
}
|
||||
|
||||
// NewPageview creates a new Pageview Hit Type.
|
||||
func NewPageview() *Pageview {
|
||||
h := &Pageview{}
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Pageview) addFields(v url.Values) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Pageview) Copy() *Pageview {
|
||||
c := *h
|
||||
return &c
|
||||
}
|
24
vendor/github.com/jpillora/go-ogle-analytics/type-screenview.go
generated
vendored
Normal file
24
vendor/github.com/jpillora/go-ogle-analytics/type-screenview.go
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
package ga
|
||||
|
||||
import "net/url"
|
||||
|
||||
//WARNING: This file was generated. Do not edit.
|
||||
|
||||
//Screenview Hit Type
|
||||
type Screenview struct {
|
||||
}
|
||||
|
||||
// NewScreenview creates a new Screenview Hit Type.
|
||||
func NewScreenview() *Screenview {
|
||||
h := &Screenview{}
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Screenview) addFields(v url.Values) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Screenview) Copy() *Screenview {
|
||||
c := *h
|
||||
return &c
|
||||
}
|
41
vendor/github.com/jpillora/go-ogle-analytics/type-social.go
generated
vendored
Normal file
41
vendor/github.com/jpillora/go-ogle-analytics/type-social.go
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
package ga
|
||||
|
||||
import "net/url"
|
||||
|
||||
//WARNING: This file was generated. Do not edit.
|
||||
|
||||
//Social Hit Type
|
||||
type Social struct {
|
||||
network string
|
||||
action string
|
||||
actionTarget string
|
||||
}
|
||||
|
||||
// NewSocial creates a new Social Hit Type.
|
||||
// Specifies the social network, for example Facebook or Google
|
||||
// Plus.
|
||||
// Specifies the social interaction action. For example on
|
||||
// Google Plus when a user clicks the +1 button, the social
|
||||
// action is 'plus'.
|
||||
// Specifies the target of a social interaction. This value
|
||||
// is typically a URL but can be any text.
|
||||
func NewSocial(network string, action string, actionTarget string) *Social {
|
||||
h := &Social{
|
||||
network: network,
|
||||
action: action,
|
||||
actionTarget: actionTarget,
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Social) addFields(v url.Values) error {
|
||||
v.Add("sn", h.network)
|
||||
v.Add("sa", h.action)
|
||||
v.Add("st", h.actionTarget)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Social) Copy() *Social {
|
||||
c := *h
|
||||
return &c
|
||||
}
|
177
vendor/github.com/jpillora/go-ogle-analytics/type-timing.go
generated
vendored
Normal file
177
vendor/github.com/jpillora/go-ogle-analytics/type-timing.go
generated
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
package ga
|
||||
|
||||
import "net/url"
|
||||
|
||||
//WARNING: This file was generated. Do not edit.
|
||||
|
||||
//Timing Hit Type
|
||||
type Timing struct {
|
||||
userTimingCategory string
|
||||
userTimingCategorySet bool
|
||||
userTimingVariableName string
|
||||
userTimingVariableNameSet bool
|
||||
userTimingTime int64
|
||||
userTimingTimeSet bool
|
||||
userTimingLabel string
|
||||
userTimingLabelSet bool
|
||||
pageLoadTime int64
|
||||
pageLoadTimeSet bool
|
||||
dNSTime int64
|
||||
dNSTimeSet bool
|
||||
pageDownloadTime int64
|
||||
pageDownloadTimeSet bool
|
||||
redirectResponseTime int64
|
||||
redirectResponseTimeSet bool
|
||||
tCPConnectTime int64
|
||||
tCPConnectTimeSet bool
|
||||
serverResponseTime int64
|
||||
serverResponseTimeSet bool
|
||||
dOMInteractiveTime int64
|
||||
dOMInteractiveTimeSet bool
|
||||
contentLoadTime int64
|
||||
contentLoadTimeSet bool
|
||||
}
|
||||
|
||||
// NewTiming creates a new Timing Hit Type.
|
||||
|
||||
func NewTiming() *Timing {
|
||||
h := &Timing{}
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Timing) addFields(v url.Values) error {
|
||||
if h.userTimingCategorySet {
|
||||
v.Add("utc", h.userTimingCategory)
|
||||
}
|
||||
if h.userTimingVariableNameSet {
|
||||
v.Add("utv", h.userTimingVariableName)
|
||||
}
|
||||
if h.userTimingTimeSet {
|
||||
v.Add("utt", int2str(h.userTimingTime))
|
||||
}
|
||||
if h.userTimingLabelSet {
|
||||
v.Add("utl", h.userTimingLabel)
|
||||
}
|
||||
if h.pageLoadTimeSet {
|
||||
v.Add("plt", int2str(h.pageLoadTime))
|
||||
}
|
||||
if h.dNSTimeSet {
|
||||
v.Add("dns", int2str(h.dNSTime))
|
||||
}
|
||||
if h.pageDownloadTimeSet {
|
||||
v.Add("pdt", int2str(h.pageDownloadTime))
|
||||
}
|
||||
if h.redirectResponseTimeSet {
|
||||
v.Add("rrt", int2str(h.redirectResponseTime))
|
||||
}
|
||||
if h.tCPConnectTimeSet {
|
||||
v.Add("tcp", int2str(h.tCPConnectTime))
|
||||
}
|
||||
if h.serverResponseTimeSet {
|
||||
v.Add("srt", int2str(h.serverResponseTime))
|
||||
}
|
||||
if h.dOMInteractiveTimeSet {
|
||||
v.Add("dit", int2str(h.dOMInteractiveTime))
|
||||
}
|
||||
if h.contentLoadTimeSet {
|
||||
v.Add("clt", int2str(h.contentLoadTime))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Specifies the user timing category.
|
||||
func (h *Timing) UserTimingCategory(userTimingCategory string) *Timing {
|
||||
h.userTimingCategory = userTimingCategory
|
||||
h.userTimingCategorySet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the user timing variable.
|
||||
func (h *Timing) UserTimingVariableName(userTimingVariableName string) *Timing {
|
||||
h.userTimingVariableName = userTimingVariableName
|
||||
h.userTimingVariableNameSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the user timing value. The value is in milliseconds.
|
||||
func (h *Timing) UserTimingTime(userTimingTime int64) *Timing {
|
||||
h.userTimingTime = userTimingTime
|
||||
h.userTimingTimeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the user timing label.
|
||||
func (h *Timing) UserTimingLabel(userTimingLabel string) *Timing {
|
||||
h.userTimingLabel = userTimingLabel
|
||||
h.userTimingLabelSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the time it took for a page to load. The value
|
||||
// is in milliseconds.
|
||||
func (h *Timing) PageLoadTime(pageLoadTime int64) *Timing {
|
||||
h.pageLoadTime = pageLoadTime
|
||||
h.pageLoadTimeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the time it took to do a DNS lookup.The value
|
||||
// is in milliseconds.
|
||||
func (h *Timing) DNSTime(dNSTime int64) *Timing {
|
||||
h.dNSTime = dNSTime
|
||||
h.dNSTimeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the time it took for the page to be downloaded.
|
||||
// The value is in milliseconds.
|
||||
func (h *Timing) PageDownloadTime(pageDownloadTime int64) *Timing {
|
||||
h.pageDownloadTime = pageDownloadTime
|
||||
h.pageDownloadTimeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the time it took for any redirects to happen.
|
||||
// The value is in milliseconds.
|
||||
func (h *Timing) RedirectResponseTime(redirectResponseTime int64) *Timing {
|
||||
h.redirectResponseTime = redirectResponseTime
|
||||
h.redirectResponseTimeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the time it took for a TCP connection to be made.
|
||||
// The value is in milliseconds.
|
||||
func (h *Timing) TCPConnectTime(tCPConnectTime int64) *Timing {
|
||||
h.tCPConnectTime = tCPConnectTime
|
||||
h.tCPConnectTimeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the time it took for the server to respond after
|
||||
// the connect time. The value is in milliseconds.
|
||||
func (h *Timing) ServerResponseTime(serverResponseTime int64) *Timing {
|
||||
h.serverResponseTime = serverResponseTime
|
||||
h.serverResponseTimeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the time it took for Document.readyState to be
|
||||
// 'interactive'. The value is in milliseconds.
|
||||
func (h *Timing) DOMInteractiveTime(dOMInteractiveTime int64) *Timing {
|
||||
h.dOMInteractiveTime = dOMInteractiveTime
|
||||
h.dOMInteractiveTimeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the time it took for the DOMContentLoaded Event
|
||||
// to fire. The value is in milliseconds.
|
||||
func (h *Timing) ContentLoadTime(contentLoadTime int64) *Timing {
|
||||
h.contentLoadTime = contentLoadTime
|
||||
h.contentLoadTimeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Timing) Copy() *Timing {
|
||||
c := *h
|
||||
return &c
|
||||
}
|
95
vendor/github.com/jpillora/go-ogle-analytics/type-transaction.go
generated
vendored
Normal file
95
vendor/github.com/jpillora/go-ogle-analytics/type-transaction.go
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
package ga
|
||||
|
||||
import "net/url"
|
||||
|
||||
//WARNING: This file was generated. Do not edit.
|
||||
|
||||
//Transaction Hit Type
|
||||
type Transaction struct {
|
||||
iD string
|
||||
affiliation string
|
||||
affiliationSet bool
|
||||
revenue float64
|
||||
revenueSet bool
|
||||
shipping float64
|
||||
shippingSet bool
|
||||
tax float64
|
||||
taxSet bool
|
||||
currencyCode string
|
||||
currencyCodeSet bool
|
||||
}
|
||||
|
||||
// NewTransaction creates a new Transaction Hit Type.
|
||||
// A unique identifier for the transaction. This value should
|
||||
// be the same for both the Transaction hit and Items hits
|
||||
// associated to the particular transaction.
|
||||
|
||||
func NewTransaction(iD string) *Transaction {
|
||||
h := &Transaction{
|
||||
iD: iD,
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Transaction) addFields(v url.Values) error {
|
||||
v.Add("ti", h.iD)
|
||||
if h.affiliationSet {
|
||||
v.Add("ta", h.affiliation)
|
||||
}
|
||||
if h.revenueSet {
|
||||
v.Add("tr", float2str(h.revenue))
|
||||
}
|
||||
if h.shippingSet {
|
||||
v.Add("ts", float2str(h.shipping))
|
||||
}
|
||||
if h.taxSet {
|
||||
v.Add("tt", float2str(h.tax))
|
||||
}
|
||||
if h.currencyCodeSet {
|
||||
v.Add("cu", h.currencyCode)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Specifies the affiliation or store name.
|
||||
func (h *Transaction) Affiliation(affiliation string) *Transaction {
|
||||
h.affiliation = affiliation
|
||||
h.affiliationSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the total revenue associated with the transaction.
|
||||
// This value should include any shipping or tax costs.
|
||||
func (h *Transaction) Revenue(revenue float64) *Transaction {
|
||||
h.revenue = revenue
|
||||
h.revenueSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the total shipping cost of the transaction.
|
||||
func (h *Transaction) Shipping(shipping float64) *Transaction {
|
||||
h.shipping = shipping
|
||||
h.shippingSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// Specifies the total tax of the transaction.
|
||||
func (h *Transaction) Tax(tax float64) *Transaction {
|
||||
h.tax = tax
|
||||
h.taxSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
// When present indicates the local currency for all transaction
|
||||
// currency values. Value should be a valid ISO 4217 currency
|
||||
// code.
|
||||
func (h *Transaction) CurrencyCode(currencyCode string) *Transaction {
|
||||
h.currencyCode = currencyCode
|
||||
h.currencyCodeSet = true
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Transaction) Copy() *Transaction {
|
||||
c := *h
|
||||
return &c
|
||||
}
|
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
@ -518,6 +518,12 @@
|
||||
"revision": "4ed13390c0acd2ff4e371e64d8b97c8954138243",
|
||||
"revisionTime": "2015-09-07T11:02:28+10:00"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "f+svTLsUm0KFNDl8cQqPy/M7qGg=",
|
||||
"path": "github.com/jpillora/go-ogle-analytics",
|
||||
"revision": "14b04e0594ef6a9fd943363b135656f0ec8c9d0e",
|
||||
"revisionTime": "2016-12-13T08:58:24Z"
|
||||
},
|
||||
{
|
||||
"path": "github.com/koding/cache",
|
||||
"revision": "487fc0ca06f9aa1a02d796f5510784b47d5afae2",
|
||||
|
Loading…
Reference in New Issue
Block a user