Skip to content

Commit

Permalink
Merge pull request #2571 from getlantern/analytics-updates-fffw
Browse files Browse the repository at this point in the history
code review suggestions
  • Loading branch information
atavism committed May 25, 2015
2 parents e23b2dd + 1ce6e2e commit f11e500
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/github.com/getlantern/analytics/analytics.go
Expand Up @@ -12,11 +12,9 @@ import (
)

const (
ApiEndpoint = `https://ssl.google-analytics.com/collect`
ProtocolVersion = "1"
DefaultClientVersion = "1"
TrackingId = "UA-21815217-2"
DefaultClientId = "555"
ApiEndpoint = `https://ssl.google-analytics.com/collect`
ProtocolVersion = "1"
DefaultClientId = "555"
)

var (
Expand Down Expand Up @@ -74,12 +72,13 @@ func Configure(trackingId string, version string, proxyAddr string) {
var err error
go func() {
httpClient, err = util.HTTPClient("", proxyAddr)

// Store new session info whenever client proxy is ready
SessionEvent(version, trackingId)
if err != nil {
log.Errorf("Could not create HTTP client")
log.Errorf("Could not create HTTP client via %s: %s", proxyAddr, err)
return
}

// Store new session info whenever client proxy is ready
sessionEvent(version, trackingId)
}()
}

Expand Down Expand Up @@ -132,7 +131,7 @@ func collectArgs(payload *Payload) string {
// Makes a tracking request to Google Analytics
func SendRequest(payload *Payload) (status bool, err error) {
if httpClient == nil {
log.Error("No default http client; could not send HTTP request to GA")
log.Error("No HTTP client; could not send HTTP request to GA")
return false, nil
}

Expand All @@ -159,7 +158,7 @@ func SendRequest(payload *Payload) (status bool, err error) {
}

// Fired whenever a new Lanern session is initiated
func SessionEvent(trackingId string, version string) (status bool, err error) {
func sessionEvent(trackingId string, version string) (status bool, err error) {

sessionPayload := &Payload{
HitType: EventType,
Expand Down

0 comments on commit f11e500

Please sign in to comment.