Hubble iOS SDK enables you to track events, identify users, and show in-product surveys.
- iOS 15.1+
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")
To integrate Hubble into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'Hubble', '~> 1.0'
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>"))
}
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()
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")
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>
)
Hubble iOS SDK is available under the Apache 2.0 license. See the LICENSE file for more info.
For support, feedback, or suggestions, please reach out to us at:
- Email: hello@hubble.team
- or join our Slack Community Group