Documentation
¶
Index ¶
- Constants
- Variables
- type Event
- type Export
- type HttpError
- type Identity
- type IdentityEvent
- type IdentityOptions
- type ImportFailedRecords
- type ImportFailedValidationError
- type ImportGenericError
- type ImportOptions
- type ImportRateLimitError
- type ImportSuccess
- type Ingestion
- type LookupTable
- type LookupTableError
- type LookupTableResults
- type Mixpanel
- func (m *Mixpanel) CreateIdentity(ctx context.Context, events []*IdentityEvent, identityOptions IdentityOptions) error
- func (m *Mixpanel) Export(ctx context.Context, fromDate, toDate time.Time, limit int, ...) ([]*Event, error)
- func (m *Mixpanel) GroupDelete(ctx context.Context, groupKey, groupID string) error
- func (m *Mixpanel) GroupDeleteProperty(ctx context.Context, groupKey, groupID string, unset []string) error
- func (m *Mixpanel) GroupRemoveListProperty(ctx context.Context, groupKey, groupID string, remove map[string]string) error
- func (m *Mixpanel) GroupSetOnce(ctx context.Context, groupKey, groupID string, set map[string]any) error
- func (m *Mixpanel) GroupUnionListProperty(ctx context.Context, groupKey, groupID string, union map[string]any) error
- func (m *Mixpanel) GroupUpdateProperty(ctx context.Context, groupKey, groupID string, set map[string]string) error
- func (m *Mixpanel) Import(ctx context.Context, events []*Event, options ImportOptions) (*ImportSuccess, error)
- func (m *Mixpanel) ListLookupTables(ctx context.Context) (*LookupTable, error)
- func (m *Mixpanel) NewEvent(name string, distinctID string, properties map[string]any) *Event
- func (m *Mixpanel) NewEventFromJson(json map[string]any) (*Event, error)
- func (m *Mixpanel) NewIdentityEvent(distinctID string, properties map[string]any, identifiedId, anonId string) *IdentityEvent
- func (m *Mixpanel) PeopleAppendListProperty(ctx context.Context, distinctID string, append map[string]any) error
- func (m *Mixpanel) PeopleDeleteProfile(ctx context.Context, distinctID string, ignoreAlias bool) error
- func (m *Mixpanel) PeopleDeleteProperty(ctx context.Context, distinctID string, unset []string) error
- func (m *Mixpanel) PeopleIncrement(ctx context.Context, distinctID string, add map[string]int) error
- func (m *Mixpanel) PeopleRemoveListProperty(ctx context.Context, distinctID string, remove map[string]any) error
- func (m *Mixpanel) PeopleSet(ctx context.Context, people []*PeopleProperties) error
- func (m *Mixpanel) PeopleSetOnce(ctx context.Context, people []*PeopleProperties) error
- func (m *Mixpanel) PeopleUnionProperty(ctx context.Context, distinctID string, union map[string]any) error
- func (m *Mixpanel) Track(ctx context.Context, events []*Event) error
- type MpApi
- type MpCompression
- type Options
- func ApiSecret(apiSecret string) Options
- func DebugHttpCalls(writer io.Writer) Options
- func EuResidency() Options
- func HttpClient(client *http.Client) Options
- func ProjectID(projectID int) Options
- func ProxyApiLocation(proxy string) Options
- func ProxyDataLocation(proxy string) Options
- func ServiceAccount(username, secret string) Options
- type PeopleError
- type PeopleProperties
- type PeopleReveredProperties
- type VerboseError
Constants ¶
const ( ExportNoLimit int = 0 ExportNoEventFilter string = "" ExportNoWhereFilter string = "" )
const ( MaxTrackEvents = 50 MaxImportEvents = 2_000 MaxPeopleEvents = 2_000 )
const (
EmptyDistinctID = ""
)
Variables ¶
var (
ErrStatusCode = errors.New("unexpected status code")
)
var ImportOptionsRecommend = ImportOptions{ Strict: true, Compression: Gzip, }
Functions ¶
This section is empty.
Types ¶
type Event ¶
Event is a mixpanel event: https://help.mixpanel.com/hc/en-us/articles/360041995352-Mixpanel-Concepts-Events
func (*Event) AddIP ¶
AddIP if you supply a property ip with an IP address Mixpanel will automatically do a GeoIP lookup and replace the ip property with geographic properties (City, Country, Region). These properties can be used in our UI to segment events geographically. https://developer.mixpanel.com/reference/import-events#geoip-enrichment
func (*Event) AddInsertID ¶
AddInsertID inserts the insert_id property into the properties https://developer.mixpanel.com/reference/import-events#propertiesinsert_id
type Identity ¶ added in v0.0.3
type Identity interface {
CreateIdentity(ctx context.Context, events []*IdentityEvent, options IdentityOptions) error
}
type IdentityEvent ¶ added in v0.0.3
type IdentityEvent struct {
*Event
}
func (*IdentityEvent) AnonId ¶ added in v0.0.3
func (i *IdentityEvent) AnonId(id string)
func (*IdentityEvent) IdentifiedId ¶ added in v0.0.3
func (i *IdentityEvent) IdentifiedId() any
func (*IdentityEvent) SetAnonId ¶ added in v0.0.3
func (i *IdentityEvent) SetAnonId(id string)
A distinct_id to merge with the $identified_id. The $anon_id must be UUID v4 format and not already merged to an $identified_id.
func (*IdentityEvent) SetIdentifiedId ¶ added in v0.0.3
func (i *IdentityEvent) SetIdentifiedId(id string)
A distinct_id to merge with the $anon_id.
type IdentityOptions ¶ added in v0.0.3
type IdentityOptions struct {
Strict bool
}
type ImportFailedRecords ¶
type ImportFailedValidationError ¶
type ImportFailedValidationError struct { Code int `json:"code"` ApiError string `json:"error"` Status interface{} `json:"status"` NumRecordsImported int `json:"num_records_imported"` FailedImportRecords []ImportFailedRecords `json:"failed_records"` }
func (ImportFailedValidationError) Error ¶
func (e ImportFailedValidationError) Error() string
type ImportGenericError ¶
type ImportGenericError struct { Code int `json:"code"` ApiError string `json:"error"` Status interface{} `json:"status"` }
func (ImportGenericError) Error ¶
func (e ImportGenericError) Error() string
type ImportOptions ¶
type ImportOptions struct { Strict bool Compression MpCompression }
type ImportRateLimitError ¶ added in v0.0.4
type ImportRateLimitError struct {
ImportGenericError
}
type ImportSuccess ¶
type Ingestion ¶
type Ingestion interface { // Events Track(ctx context.Context, events []*Event) error Import(ctx context.Context, events []*Event, options ImportOptions) (*ImportSuccess, error) // People PeopleSet(ctx context.Context, people []*PeopleProperties) error PeopleSetOnce(ctx context.Context, people []*PeopleProperties) error PeopleIncrement(ctx context.Context, distinctID string, add map[string]int) error PeopleUnionProperty(ctx context.Context, distinctID string, union map[string]any) error PeopleAppendListProperty(ctx context.Context, distinctID string, append map[string]any) error PeopleRemoveListProperty(ctx context.Context, distinctID string, remove map[string]any) error PeopleDeleteProperty(ctx context.Context, distinctID string, unset []string) error PeopleDeleteProfile(ctx context.Context, distinctID string, ignoreAlias bool) error // Groups GroupUpdateProperty(ctx context.Context, groupKey, groupID string, set map[string]string) error GroupSetOnce(ctx context.Context, groupKey, groupID string, set map[string]any) error GroupDeleteProperty(ctx context.Context, groupKey, groupID string, unset []string) error GroupRemoveListProperty(ctx context.Context, groupKey, groupID string, remove map[string]string) error GroupUnionListProperty(ctx context.Context, groupKey, groupID string, union map[string]any) error GroupDelete(ctx context.Context, groupKey, groupID string) error // Lookup ListLookupTables(ctx context.Context) (*LookupTable, error) }
type LookupTable ¶
type LookupTable struct { Code int `json:"code"` Status string `json:"status"` Results []LookupTableResults `json:"results"` }
type LookupTableError ¶
type LookupTableError struct { Code int `json:"code"` ApiError string `json:"error"` Status interface{} `json:"status"` }
func (LookupTableError) Error ¶
func (e LookupTableError) Error() string
type LookupTableResults ¶
type Mixpanel ¶
type Mixpanel struct {
// contains filtered or unexported fields
}
func (*Mixpanel) CreateIdentity ¶ added in v0.0.3
func (m *Mixpanel) CreateIdentity(ctx context.Context, events []*IdentityEvent, identityOptions IdentityOptions) error
func (*Mixpanel) Export ¶
func (m *Mixpanel) Export(ctx context.Context, fromDate, toDate time.Time, limit int, event, where string) ([]*Event, error)
Example on how to explore everything fromDate - toDate Export(ctx, fromDate, toDate, ExportNoLimit, ExportNoEventFilter, ExportNoWhereFilter)
func (*Mixpanel) GroupDelete ¶
GroupDelete calls the Groups Delete API https://developer.mixpanel.com/reference/delete-group
func (*Mixpanel) GroupDeleteProperty ¶
func (m *Mixpanel) GroupDeleteProperty(ctx context.Context, groupKey, groupID string, unset []string) error
GroupDeleteProperty calls the group delete property API https://developer.mixpanel.com/reference/group-delete-property
func (*Mixpanel) GroupRemoveListProperty ¶
func (m *Mixpanel) GroupRemoveListProperty(ctx context.Context, groupKey, groupID string, remove map[string]string) error
GroupRemoveListProperty calls the Groups Remove from List Property API https://developer.mixpanel.com/reference/group-remove-from-list-property
func (*Mixpanel) GroupSetOnce ¶
func (m *Mixpanel) GroupSetOnce(ctx context.Context, groupKey, groupID string, set map[string]any) error
GroupSetOnce calls the Group Set Property Once API https://developer.mixpanel.com/reference/group-set-property-once
func (*Mixpanel) GroupUnionListProperty ¶
func (m *Mixpanel) GroupUnionListProperty(ctx context.Context, groupKey, groupID string, union map[string]any) error
GroupUnionListProperty calls the Groups Remove from Union Property API https://developer.mixpanel.com/reference/group-union
func (*Mixpanel) GroupUpdateProperty ¶
func (m *Mixpanel) GroupUpdateProperty(ctx context.Context, groupKey, groupID string, set map[string]string) error
GroupUpdateProperty calls the Group Update Property API https://developer.mixpanel.com/reference/group-set-property
func (*Mixpanel) Import ¶
func (m *Mixpanel) Import(ctx context.Context, events []*Event, options ImportOptions) (*ImportSuccess, error)
Import calls the Import api https://developer.mixpanel.com/reference/import-events
func (*Mixpanel) ListLookupTables ¶
func (m *Mixpanel) ListLookupTables(ctx context.Context) (*LookupTable, error)
ListLookupTables calls the List Lookup Tables API https://developer.mixpanel.com/reference/list-lookup-tables
func (*Mixpanel) NewEventFromJson ¶
func (*Mixpanel) NewIdentityEvent ¶ added in v0.0.3
func (*Mixpanel) PeopleAppendListProperty ¶
func (m *Mixpanel) PeopleAppendListProperty(ctx context.Context, distinctID string, append map[string]any) error
PeopleAppend calls the Increment Numerical Property https://developer.mixpanel.com/reference/profile-numerical-add
func (*Mixpanel) PeopleDeleteProfile ¶
func (m *Mixpanel) PeopleDeleteProfile(ctx context.Context, distinctID string, ignoreAlias bool) error
PeopleDeleteProfile calls the User Delete Profile API https://developer.mixpanel.com/reference/delete-profile
func (*Mixpanel) PeopleDeleteProperty ¶
func (m *Mixpanel) PeopleDeleteProperty(ctx context.Context, distinctID string, unset []string) error
PeopleDeleteProperty calls the User Delete Property API https://developer.mixpanel.com/reference/profile-delete-property
func (*Mixpanel) PeopleIncrement ¶
func (m *Mixpanel) PeopleIncrement(ctx context.Context, distinctID string, add map[string]int) error
PeopleIncrement calls the User Increment Numerical Property API https://developer.mixpanel.com/reference/profile-numerical-add
func (*Mixpanel) PeopleRemoveListProperty ¶
func (m *Mixpanel) PeopleRemoveListProperty(ctx context.Context, distinctID string, remove map[string]any) error
PeopleRemoveListProperty calls the User Remove from List Property API https://developer.mixpanel.com/reference/profile-remove-from-list-property
func (*Mixpanel) PeopleSet ¶
func (m *Mixpanel) PeopleSet(ctx context.Context, people []*PeopleProperties) error
PeopleSet calls the User Set Property API https://developer.mixpanel.com/reference/profile-set
func (*Mixpanel) PeopleSetOnce ¶
func (m *Mixpanel) PeopleSetOnce(ctx context.Context, people []*PeopleProperties) error
PeopleSetOnce calls the User Set Property Once API https://developer.mixpanel.com/reference/profile-set-property-once
func (*Mixpanel) PeopleUnionProperty ¶
func (m *Mixpanel) PeopleUnionProperty(ctx context.Context, distinctID string, union map[string]any) error
PeopleUnionProperty calls User Union To List Property API https://developer.mixpanel.com/reference/user-profile-union
type MpApi ¶
MpApi is all the API's in the Mixpanel docs https://developer.mixpanel.com/reference/overview
type Options ¶
type Options func(mixpanel *Mixpanel)
func DebugHttpCalls ¶
DebugHttpCalls streams payload information and url information for debugging purposes
func EuResidency ¶
func EuResidency() Options
EuResidency sets the mixpanel client to use the eu endpoints Use for EU Projects
func HttpClient ¶
HttpClient will replace the http.DefaultClient with the provided http.Client
func ProxyApiLocation ¶
ProxyApiLocation sets the mixpanel client to use the custom location for all ingestion requests Example: http://locahosthost:8080
func ProxyDataLocation ¶
ProxyDataLocation sets the mixpanel client to use the custom location for all data requests Example: http://locahosthost:8080
func ServiceAccount ¶
ServiceAccount add a service account to the mixpanel client https://developer.mixpanel.com/reference/service-accounts-api
type PeopleError ¶
type PeopleError struct {
Code int `json:"code"`
}
func (PeopleError) Error ¶
func (p PeopleError) Error() string
type PeopleProperties ¶ added in v0.0.4
func NewPeopleProperties ¶ added in v0.0.4
func NewPeopleProperties(distinctID string, properties map[string]any) *PeopleProperties
func (*PeopleProperties) SetIp ¶ added in v0.0.4
func (p *PeopleProperties) SetIp(ip net.IP)
func (*PeopleProperties) SetReservedProperty ¶ added in v0.0.4
func (p *PeopleProperties) SetReservedProperty(property PeopleReveredProperties, value any)
type PeopleReveredProperties ¶ added in v0.0.4
type PeopleReveredProperties string
const ( PeopleEmailProperty PeopleReveredProperties = "$email" PeoplePhoneProperty PeopleReveredProperties = "$phone" PeopleFirstNameProperty PeopleReveredProperties = "$first_name" PeopleLastNameProperty PeopleReveredProperties = "$last_name" PeopleNameProperty PeopleReveredProperties = "$name" PeopleAvatarProperty PeopleReveredProperties = "$avatar" PeopleCreatedProperty PeopleReveredProperties = "$created" PeopleCityProperty PeopleReveredProperties = "$city" PeopleRegionProperty PeopleReveredProperties = "$region" PeopleCountryCodeProperty PeopleReveredProperties = "$country_code" PeopleTimezoneProperty PeopleReveredProperties = "$timezone" PeopleBucketProperty PeopleReveredProperties = "$bucket" PeopleGeolocationByIpProperty PeopleReveredProperties = "$ip" )
type VerboseError ¶
func (VerboseError) Error ¶
func (a VerboseError) Error() string