Skip to content

hubble-team/hubble-ios-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hubble iOS SDK

Landing page

Hubble iOS SDK enables you to track events, identify users, and show in-product surveys.

Requirements

  • iOS 15.1+

Installation

Swift Package Manager

You can use The Swift Package Manager to install Hubble by adding the proper description to your Package.swift file:

dependencies: [
  .package(url: "https://github.com/hubble-team/hubble-ios-sdk", from: "1.0.0")
],

Normally you'll want to depend on the Hubble target:

.product(name: "Hubble", package: "Hubble")

Cocoapods

To integrate Hubble into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'Hubble', '~> 1.0'

Usage

Initialize

First, initialize the HubbleConnect instance using the team ID found on your team's dashboard.

import Hubble

extension HubbleConnect {
    static let shared = HubbleConnect(configuration: .init(teamID: "<your-team-id>"))
}

Identify Users

The Hubble SDK enables the identification of users and the assignment of custom attributes. By identifying a user with a custom user ID, you can target surveys to specific user segments based on their attributes.

HubbleConnect.shared.identify(userID: "your_existing_user_id", properties: ["eyeColor": "gold"])

To stop identifying a user (e.g., during sign out), use the reset method:

HubbleConnect.shared.reset()

Track Events

The Hubble SDK offers an event tracking system, allowing you to record specific actions within your application. These events can trigger custom surveys.

HubbleConnect.shared.trackEvent(name: "USER_PURCHASED")

Show survey (For debugging purposes)

For debugging purposes, you can manually trigger an in-product survey using the survey ID found in the survey URL.

HubbleConnect.shared.showSurvey(withID: "<survey-id>")

Use the survey ID from the specific URL provided: (e.g. https://app.hubble.team/surveys/<survey-id>)

License

Hubble iOS SDK is available under the Apache 2.0 license. See the LICENSE file for more info.

Contact

For support, feedback, or suggestions, please reach out to us at: