Skip to content
Unofficial Swift Mixpanel client
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Mixpanel.xcodeproj
Mixpanel Version 0.2.1 Dec 12, 2017
.gitignore Setup tests and watchOS target Jun 22, 2015
.swift-version
Cartfile.private
Cartfile.resolved Update for Swift 4.2 Sep 20, 2018
LICENSE
Readme.markdown Update for Swift 4.2 Sep 20, 2018

Readme.markdown

Mixpanel

Version Swift Version Carthage compatible

Unofficial Mixpanel client written in Swift 4.2 for iOS and Mac.

This is a very simple client that just implements tracking events and identifying the current user. A network request is initiated whenver you call track. If it fails, nothing happens. Eventually, it would be cool if it stored these and retried at some point.

Installation

Carthage is the recommended way to install Mixpanel. Add the following to your Cartfile:

github "soffes/Mixpanel"

Usage

import Mixpanel

// Setup a client
let mixpanel = Mixpanel(token: "your app token")

// Identify the current user. This doesn't make a network request. It simply
// will add their identifer to the next event tracked.
mixpanel.identify("7")

// Track an event
mixpanel.track("Launch")

// Track an event with parameters
mixpanel.track("Share", parameters: [
  "service": "Twitter",
])

// You can also customize the time the event happened and add a completion
// handler if you want.
mixpanel.track("Import photo", parameters: [
  "source": "Photo library"
], time: someTime, completion: (success) in {
  println("Tracked event successfully: \(success)")
})

Enjoy.

You can’t perform that action at this time.