Golang Mixpanel Client

mixpanel

Mixpanel Go Client

Donate to 1P8ccYhVt4ByLahuVXiCY6U185gmYA8Rqf

Usage

import "github.com/dukex/mixpanel"

--

documentation on godoc

Examples

Track

err := client.Track("13793", "Signed Up", map[string]interface{}{
	"Referred By": "Friend",
})

--

Identify and Update Operation

people := client.Identify("13793")

err := people.Track(map[string]interface{}{
	"Buy": "133"
})

err := people.Update("$set", map[string]interface{}{
	"Address":  "1313 Mockingbird Lane",
	"Birthday": "1948-01-01",
})

License

Released under the MIT License.

Author

Duke X (dukex)

Owner
Duke
28 years old, fullstack developer. Founder of @megafono
Duke
Comments
  • Question: how to sponsor this project?

    Question: how to sponsor this project?

    Hi 👋 ,

    Thanks so much for the work on this project! At @Reviewpad, we are trying to support the OSS projects that we use as dependencies to our main repository reviewpad/reviewpad.

    Do you plan to join any sponsoring program? We are also happy to help the community to maintain the project.

    Thanks!

  • Added mocked implementation for use in unit tests

    Added mocked implementation for use in unit tests

    Hi!

    I've changed the Mixpanel struct to be an interface and added a mock implementation in addition to the current real implementation. This makes it easy to test code which uses mixpanel:

    var client mixpanel.Mixpanel = mixpanel.NewMock()
    
    people = client.Identify("1")
    people.Update("$set", map[string]interface{}{
        "custom_field": "cool!",
    })
    
    // client.People now holds the tracked data
    

    Also, functions now only return a single error and not an HTTP response, making error handling easier.

  • use thread safe map in the mock

    use thread safe map in the mock

    There are cases when event tracking and user properties setting happen at the same time from different threads. But, since the map used in the mock is not thread safe, tests that use it fail unexpectedly. Using the sync.Map should solve the problem.

  • use thread safe map in the mock

    use thread safe map in the mock

    There are cases when event tracking and user properties setting happen at the same time from different threads. But, since the map used in the mock is not thread safe, tests that use it fail unexpectedly. Using the sync.Map should solve the problem.

  • Implement UpdateGroup endpoint

    Implement UpdateGroup endpoint

    Some time ago mixpanel released a new feature called "groups" (checkout: https://developer.mixpanel.com/reference/group-set-property). This PR add the ability to update such entity via this client.

    In order to avoid confusion in between the mutation of Users and Groups, i deprecated the Update endpoint and renamed it UpdateUser.

  • Add Import method to be able to create events older than 5 days

    Add Import method to be able to create events older than 5 days

    The main new feature is to be able to create events older than 5 days. In order to do this, basic HTTP auth has also been added (without password as it is not required to use Import). Some other small fixes were implemented too. Mixpanel docs: https://developer.mixpanel.com/docs/importing-old-events

  • Add plumbing to allow autogeolocation on the mixpanel side

    Add plumbing to allow autogeolocation on the mixpanel side

    In short, empty Event.IP/Update.IP results in a ip=1 to be appended to the url params for people updates and events. By sending ip=1, mixpanel will automatically geolocate using the ip of the requester during the API request.


    It looks like this was the intended behavior, but unfortunately it did not work as described (https://github.com/dukex/mixpanel/blob/master/mixpanel.go#L39-L40)

  • net/http: TLS handshake timeout

    net/http: TLS handshake timeout

    Hi guys.

    I'm consuming the MixPanel API using this amazing library, but I'm getting a recurring issue:

    *url.Error Get "https://api.mixpanel.com/engage?data=xx&ip=1": net/http: TLS handshake timeout

    Can you help me with this problem, please?

Clusterpedia-client - clusterpedia-client supports the use of native client-go mode to call the clusterpedia API

clusterpedia-client supports the use of native client-go mode to call the cluste

Jan 7, 2022
Client-go - Clusterpedia-client supports the use of native client-go mode to call the clusterpedia API

clusterpedia-client supports the use of native client-go mode to call the cluste

Dec 5, 2022
Client-server-golang-sqs - Client Server with SQS and golang

Client Server with SQS and golang Multi-threaded client-server demo with Go What

Feb 14, 2022
Go-http-client: An enhanced http client for Golang
Go-http-client: An enhanced http client for Golang

go-http-client An enhanced http client for Golang Documentation on go.dev ?? This package provides you a http client package for your http requests. Y

Jan 7, 2023
Client for the cloud-iso-client

cloud-iso-client Client for the cloud-iso-client. Register an API token Before using this client library, you need to register an API token under your

Dec 6, 2021
Nutanix-client-go - Go client for the Nutanix Prism V3 API

nutanix-client-go This repository contains portions of the Nutanix API client code in nutanix/terraform-provider-nutanix. It has been extracted to red

Jan 6, 2022
Aoe4-client - Client library for aoe4 leaderboards etc

AOE4 Client Overview This is a go client used to query AOE4 data from either the

Jan 18, 2022
Balabola-go-client - GO client for Yandex balabola service

Balabola GO Client GO client for Yandex balabola service Yandex warning The neur

Jan 29, 2022
Golang client for ethereum json rpc api

Ethrpc Golang client for ethereum JSON RPC API. web3_clientVersion web3_sha3 net_version net_peerCount net_listening eth_protocolVersion eth_syncing e

Jan 7, 2023
A golang client for the Twitch v3 API - public APIs only (for now)

go-twitch Test CLIENT_ID="<my client ID>" go test -v -cover Usage Example File: package main import ( "log" "os" "github.com/knspriggs/go-twi

Sep 27, 2022
a Go (Golang) MusicBrainz WS2 client library - work in progress
a Go (Golang) MusicBrainz WS2 client library - work in progress

gomusicbrainz a Go (Golang) MusicBrainz WS2 client library - a work in progress. Current state Currently GoMusicBrainz provides methods to perform sea

Sep 28, 2022
⚡️ SharePoint authentication, HTTP client & fluent API wrapper for Go (Golang)
⚡️ SharePoint authentication, HTTP client & fluent API wrapper for Go (Golang)

Gosip - SharePoint authentication, HTTP client & fluent API wrapper for Go (Golang) Main features Unattended authentication using different strategies

Jan 2, 2023
Golang client for LastPass

Go client for LastPass Features login via user name and master password two-factor authentication with out-of-band mechanism such as push notification

Dec 23, 2022
Golang client for PayPal REST API

Go client for PayPal REST API Coverage POST /v1/oauth2/token POST /v1/identity/openidconnect/tokenservice GET /v1/identity/openidconnect/userinfo/?sch

Dec 25, 2022
An API client for the Notion API implemented in Golang

An API client for the Notion API implemented in Golang

Dec 30, 2022
The client of NodeStatus / Golang Version

NodeStatus-client-go The client of NodeStatus written in Golang 使用说明 请直接下载release下的对应平台的二进制文件。 运行时需传入客户端对应参数。 假设你的服务端地址是https://tz.mydomain.com,客户端用户名

Dec 26, 2022
This is the GoLang ApiDQ API client

ApiDQ API GoLang Client This is the GoLang ApiDQ API client. This library allows using of the actual API version. You can find more info in the docume

Oct 19, 2021
golang client for illumina's basespace

a REST API client communicate with Illumina's BaseSpace The easist way to get a corresponding token https://developer.basespace.illumina.com/docs/cont

Jan 10, 2022
A Golang Client Library for building Cosmos SDK chain clients

Cosmos Client Lib in Go This is the start of ideas around how to implement the cosmos client libraries in a seperate repo How to instantiate and use t

Jan 6, 2023