sensorsanalytics

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

README

Sensors Analytics

This is the official Golang SDK for Sensors Analytics.

Easy Installation

You can get Sensors Analytics SDK using go.

	go get github.com/sensorsdata/sa-sdk-go

Or update sdk with

	go get -u github.com/sensorsdata/sa-sdk-go
	

Once the SDK is successfully installed, use the Sensors Analytics SDK likes:

    import sdk "github.com/sensorsdata/sa-sdk-go"

    // Gets the url of Sensors Analytics in the home page.
    SA_SERVER_URL = 'YOUR_SERVER_URL'

    // Initialized the Sensors Analytics SDK with Default Consumer
    consumer = sdk.InitDefaultConsumer(SA_SERVER_URL)
    sa = sdk.InitSensorsAnalytics(consumer)

    properties := map[string]interface{}{
         "price": 12,
         "name": "apple",
         "somedata": []string{"a", "b"},
    }

    // Track the event 'ServerStart'
    sa.track("ABCDEFG1234567", "ServerStart", properties, false)

    sa.Close()

More Examples

(Examples)

To Learn More

See our full manual

Documentation

Index

Constants

View Source
const (
	TRACK             = "track"
	TRACK_SIGNUP      = "track_signup"
	PROFILE_SET       = "profile_set"
	PROFILE_SET_ONCE  = "profile_set_once"
	PROFILE_INCREMENT = "profile_increment"
	PROFILE_APPEND    = "profile_append"
	PROFILE_UNSET     = "profile_unset"
	PROFILE_DELETE    = "profile_delete"

	SDK_VERSION = "1.7.5"
	LIB_NAME    = "Golang"

	MAX_ID_LEN = 255
)

Variables

This section is empty.

Functions

func InitBatchConsumer

func InitBatchConsumer(url string, max, timeout int) (*consumers.BatchConsumer, error)

func InitConcurrentLoggingConsumer

func InitConcurrentLoggingConsumer(filename string, hourRotate bool) (*consumers.ConcurrentLoggingConsumer, error)

func InitDebugConsumer

func InitDebugConsumer(url string, writeData bool, timeout int) (*consumers.DebugConsumer, error)

func InitDefaultConsumer

func InitDefaultConsumer(url string, timeout int) (*consumers.DefaultConsumer, error)

func InitLoggingConsumer

func InitLoggingConsumer(filename string, hourRotate bool) (*consumers.LoggingConsumer, error)

Types

type SensorsAnalytics

type SensorsAnalytics struct {
	C           consumers.Consumer
	ProjectName string
	TimeFree    bool
}

func InitSensorsAnalytics

func InitSensorsAnalytics(c consumers.Consumer, projectName string, timeFree bool) SensorsAnalytics

func (*SensorsAnalytics) Close

func (sa *SensorsAnalytics) Close()

func (*SensorsAnalytics) Flush

func (sa *SensorsAnalytics) Flush()

func (*SensorsAnalytics) ProfileAppend

func (sa *SensorsAnalytics) ProfileAppend(distinctId string, properties map[string]interface{}, isLoginId bool) error

func (*SensorsAnalytics) ProfileDelete

func (sa *SensorsAnalytics) ProfileDelete(distinctId string, isLoginId bool) error

func (*SensorsAnalytics) ProfileIncrement

func (sa *SensorsAnalytics) ProfileIncrement(distinctId string, properties map[string]interface{}, isLoginId bool) error

func (*SensorsAnalytics) ProfileSet

func (sa *SensorsAnalytics) ProfileSet(distinctId string, properties map[string]interface{}, isLoginId bool) error

func (*SensorsAnalytics) ProfileSetOnce

func (sa *SensorsAnalytics) ProfileSetOnce(distinctId string, properties map[string]interface{}, isLoginId bool) error

func (*SensorsAnalytics) ProfileUnset

func (sa *SensorsAnalytics) ProfileUnset(distinctId string, properties map[string]interface{}, isLoginId bool) error

func (*SensorsAnalytics) Track

func (sa *SensorsAnalytics) Track(distinctId, event string, properties map[string]interface{}, isLoginId bool) error

func (*SensorsAnalytics) TrackSignup

func (sa *SensorsAnalytics) TrackSignup(distinctId, originId string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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