For implementation details please see: https://support.kissmetrics.io/reference#ios-v2
Add pod 'KISSmetrics-iOS-SDK'
to your Podfile.
- Add the
Framework/KISSmetricsSDK.xcodeproj
to your existing project. - In your app's Target go to
Build Phases
and underDependencies
add theKISSmetricsSDK
Import the API class in your AppDelegate and in any classes where you'll be tracking from:
Swift
import KISSmetrics_iOS_SDK
Objective-C
@import KISSmetrics_iOS_SDK;
At the top of the application delegate's didFinishLaunchingWithOptions
method, add:
Swift
KISSmetricsAPI.sharedAPI(withKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
Objective-C
[KISSmetricsAPI sharedAPIWithKey:@"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"];
After initializing the API and configuring events as described above, record an event with:
Swift
KISSmetricsAPI.shared().record("/app_launched")
Objective-C
[[KISSmetricsAPI sharedAPI] record:@"/app_launched"];
To record an event with properties:
Swift
KISSmetricsAPI.shared().record("/content_view", withProperties: ["Content Name": "Rogue One"])
Objective-C
[[KISSmetricsAPI sharedAPI] record:@"/content_view" withProperties: @{ @"Content Name": @"Rogue One"}];