Coder Social home page Coder Social logo

suricforever / mixpanel-swift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mixpanel/mixpanel-swift

0.0 2.0 0.0 47.38 MB

Mixpanel tracking library for iOS (Swift)

Home Page: https://mixpanel.com

License: Other

Ruby 0.38% Swift 99.36% Objective-C 0.23% Shell 0.03%

mixpanel-swift's Introduction

Mixpanel Swift Library

Build Status Average time to resolve an issue Percentage of issues still open CocoaPods Compatible Carthage compatible Apache License Documentation

Table of Contents

Introduction

Welcome to the official Mixpanel Swift Library

The Mixpanel Swift library for iOS is an open source project, and we'd love to see your contributions! We'd also love for you to come and work with us! Check out Jobs for details.

If you are using Objective-C, we recommend using our Objective-C Library.

Current supported features

Our master branch and our releases are now on Swift 4.2.

If you wish to use our Swift 4/4.1 implementation, please point to the v2.4.5 release. If you wish to use our Swift 3 implementation, please point to the v2.2.3 release. If you wish to use our Swift 2.3 implementation, please point to the v1.0.1 release.

Our Swift library fully supports all of the Mixpanel features, and has full parity with the Objective-C Library.

Installation

CocoaPods

Our current release only supports CocoaPods version 1.1.0+

Mixpanel supports CocoaPods for easy installation. To Install, see our swift integration guide »

For iOS, tvOS, macOS, and App Extension integrations:

pod 'Mixpanel-swift'

Carthage

Mixpanel also supports Carthage to package your dependencies as a framework. Include the following dependency in your Cartfile:

github "mixpanel/mixpanel-swift"

Check out the Carthage docs » for more info.

Manual Installation

To help users stay up to date with the latests version of our Swift SDK, we always recommend integrating our SDK via CocoaPods, which simplifies version updates and dependency management. However, there are cases where users can't use CocoaPods. Not to worry, just follow these manual installation steps and you'll be all set.

Step 1: Add as a Submodule

Add Mixpanel as a submodule to your local git repo like so:

git submodule add [email protected]:mixpanel/mixpanel-swift.git

Now the Mixpanel project and its files should be in your project folder!

Step 2: Drag Mixpanel to your project

Drag the Mixpanel.xcodeproj inside your sample project under the main sample project file:

alt text

Step 3: Embed the framework

Select your app .xcodeproj file. Under "General", add the Mixpanel framework as an embedded binary:

alt text

Initializing and Usage

Integrate

Import Mixpanel into AppDelegate.swift, and initialize Mixpanel within application:didFinishLaunchingWithOptions: alt text

func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    Mixpanel.initialize(token: "MIXPANEL_TOKEN")
}

You initialize your Mixpanel instance with the token provided to you on mixpanel.com.

Start tracking

After installing the library into your iOS app, Mixpanel will automatically collect common mobile events. You can enable/ disable automatic collection through your project settings.

To interact with the instance and track additional events, you can either use the mixpanel instance given when initializing:

mixpanel.track(event: "Tracked Event!")

or you can directly fetch the instance and use it from the Mixpanel object:

Mixpanel.mainInstance().track(event: "Tracked Event!")

You're done! You've successfully integrated the Mixpanel Swift SDK into your app. To stay up to speed on important SDK releases and updates, star or watch our repository on Github.

Have any questions? Reach out to [email protected] to speak to someone smart, quickly.

mixpanel-swift's People

Contributors

albinekcom avatar alvarhansen avatar arthur-here avatar bre7 avatar brow avatar cherisegoode avatar clintron avatar dneralla avatar erenliving avatar gmorning avatar herosang avatar jaredmixpanel avatar krbarnes avatar ky1ejs avatar macmee avatar matt-loflin avatar mazyod avatar mxcl avatar sammarshall61 avatar squarelab-jwlee avatar wgins avatar yarneo avatar yas375 avatar zihejia avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.