Documentation
¶
Index ¶
- Constants
- Variables
- type Api
- type ApiClient
- func (a *ApiClient) Alias(ctx context.Context, aliasID, distinctID string) error
- func (a *ApiClient) Export(ctx context.Context, fromDate, toDate time.Time, limit int, ...) ([]*Event, error)
- func (a *ApiClient) GroupDelete(ctx context.Context, groupKey, groupID string) error
- func (a *ApiClient) GroupDeleteProperty(ctx context.Context, groupKey, groupID string, unset []string) error
- func (a *ApiClient) GroupRemoveListProperty(ctx context.Context, groupKey, groupID string, remove map[string]any) error
- func (a *ApiClient) GroupSet(ctx context.Context, groupKey, groupID string, set map[string]any) error
- func (a *ApiClient) GroupSetOnce(ctx context.Context, groupKey, groupID string, set map[string]any) error
- func (a *ApiClient) GroupUnionListProperty(ctx context.Context, groupKey, groupID string, union map[string]any) error
- func (a *ApiClient) Import(ctx context.Context, events []*Event, options ImportOptions) (*ImportSuccess, error)
- func (a *ApiClient) Merge(ctx context.Context, distinctID1, distinctID2 string) error
- func (m *ApiClient) NewEvent(name string, distinctID string, properties map[string]any) *Event
- func (m *ApiClient) NewEventFromJson(json map[string]any) (*Event, error)
- func (a *ApiClient) PeopleAppendListProperty(ctx context.Context, distinctID string, append map[string]any) error
- func (a *ApiClient) PeopleDeleteProfile(ctx context.Context, distinctID string, ignoreAlias bool) error
- func (a *ApiClient) PeopleDeleteProperty(ctx context.Context, distinctID string, unset []string) error
- func (a *ApiClient) PeopleIncrement(ctx context.Context, distinctID string, add map[string]int) error
- func (a *ApiClient) PeopleRemoveListProperty(ctx context.Context, distinctID string, remove map[string]any) error
- func (a *ApiClient) PeopleSet(ctx context.Context, people []*PeopleProperties) error
- func (a *ApiClient) PeopleSetOnce(ctx context.Context, people []*PeopleProperties) error
- func (a *ApiClient) PeopleUnionProperty(ctx context.Context, distinctID string, union map[string]any) error
- func (m *ApiClient) Track(ctx context.Context, events []*Event) error
- type Event
- type Export
- type HttpError
- type Identity
- type ImportFailedRecords
- type ImportFailedValidationError
- type ImportGenericError
- type ImportOptions
- type ImportRateLimitError
- type ImportSuccess
- type Ingestion
- 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 ProxyApiLocation(proxy string) Options
- func ProxyDataLocation(proxy string) Options
- func ServiceAccount(projectID int, username, secret string) Options
- type PeopleIpOptions
- type PeopleProperties
- type PeopleReveredProperties
- type VerboseError
Constants ¶
const ( ExportNoLimit int = 0 ExportNoEventFilter string = "" ExportNoWhereFilter string = "" )
const ( MaxTrackEvents = 2_000 MaxImportEvents = 2_000 MaxPeopleEvents = 2_000 )
const (
EmptyDistinctID = ""
)
Variables ¶
var (
ErrUnexpectedStatus = errors.New("unexpected status code")
)
var ImportOptionsRecommend = ImportOptions{ Strict: true, Compression: Gzip, }
Functions ¶
This section is empty.
Types ¶
type Api ¶
Api is all the API's in the Mixpanel docs https://developer.mixpanel.com/reference/overview
type ApiClient ¶
type ApiClient struct {
// contains filtered or unexported fields
}
func NewApiClient ¶
NewApiClient create a new mixpanel client
func (*ApiClient) Alias ¶
https://developer.mixpanel.com/reference/identity-create-alias
func (*ApiClient) Export ¶
func (a *ApiClient) Export(ctx context.Context, fromDate, toDate time.Time, limit int, event, where string) ([]*Event, error)
Export calls the Raw Export API https://developer.mixpanel.com/reference/raw-event-export
func (*ApiClient) GroupDelete ¶
GroupDelete calls the Groups Delete API https://developer.mixpanel.com/reference/delete-group
func (*ApiClient) GroupDeleteProperty ¶
func (a *ApiClient) 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 (*ApiClient) GroupRemoveListProperty ¶
func (a *ApiClient) GroupRemoveListProperty(ctx context.Context, groupKey, groupID string, remove map[string]any) error
GroupRemoveListProperty calls the Groups Remove from List Property API https://developer.mixpanel.com/reference/group-remove-from-list-property
func (*ApiClient) GroupSet ¶
func (a *ApiClient) GroupSet(ctx context.Context, groupKey, groupID string, set map[string]any) error
GroupUpdateProperty calls the Group Update Property API https://developer.mixpanel.com/reference/group-set-property
func (*ApiClient) GroupSetOnce ¶
func (a *ApiClient) 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 (*ApiClient) GroupUnionListProperty ¶
func (a *ApiClient) 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 (*ApiClient) Import ¶
func (a *ApiClient) Import(ctx context.Context, events []*Event, options ImportOptions) (*ImportSuccess, error)
Import calls the Import api https://developer.mixpanel.com/reference/import-events Need to provide project id a service account, project token or api secret to the client
func (*ApiClient) Merge ¶
https://developer.mixpanel.com/reference/identity-merge must provide api secret
func (*ApiClient) NewEventFromJson ¶
func (*ApiClient) PeopleAppendListProperty ¶
func (a *ApiClient) 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 (*ApiClient) PeopleDeleteProfile ¶
func (a *ApiClient) PeopleDeleteProfile(ctx context.Context, distinctID string, ignoreAlias bool) error
PeopleDeleteProfile calls the User Delete Profile API https://developer.mixpanel.com/reference/delete-profile
func (*ApiClient) PeopleDeleteProperty ¶
func (a *ApiClient) 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 (*ApiClient) PeopleIncrement ¶
func (a *ApiClient) 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 (*ApiClient) PeopleRemoveListProperty ¶
func (a *ApiClient) 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 (*ApiClient) PeopleSet ¶
func (a *ApiClient) PeopleSet(ctx context.Context, people []*PeopleProperties) error
PeopleSet calls the User Set Property API https://developer.mixpanel.com/reference/profile-set
func (*ApiClient) PeopleSetOnce ¶
func (a *ApiClient) 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 (*ApiClient) PeopleUnionProperty ¶
func (a *ApiClient) 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 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 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 ¶
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 GroupSet(ctx context.Context, groupKey, groupID string, set map[string]any) 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]any) error GroupUnionListProperty(ctx context.Context, groupKey, groupID string, union map[string]any) error GroupDelete(ctx context.Context, groupKey, groupID string) error }
type Options ¶
type Options func(mixpanel *ApiClient)
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 PeopleIpOptions ¶
type PeopleIpOptions = func(peopleProperties *PeopleProperties)
func UseRequestIp ¶
func UseRequestIp() PeopleIpOptions
type PeopleProperties ¶
func NewPeopleProperties ¶
func NewPeopleProperties(distinctID string, properties map[string]any) *PeopleProperties
func (*PeopleProperties) SetIp ¶
func (p *PeopleProperties) SetIp(ip net.IP, options ...PeopleIpOptions)
SetIp will cause mixpanel to geo lookup the ip for the user if no ip is provided, we will not lookup if ip is provided, we will lookup the ip if you want to use the request ip to lookup the geo location then use UseRequestIp option
func (*PeopleProperties) SetReservedProperty ¶
func (p *PeopleProperties) SetReservedProperty(property PeopleReveredProperties, value any)
type PeopleReveredProperties ¶
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