CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapodsTo integrate the SDK into your Xcode project using CocoaPods, please, specify it in your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '12.0'
use_frameworks!
target '<Your Target Name>' do
pod 'WoopraSDK', '1.2.0'
endThen, run the following command:
$ pod install- Add a package by selecting
File→Add Package Dependencies...in Xcode’s menu bar. - Search for the
WoopraSDKusing the repo's URL:https://github.com/Woopra/Woopra-iOS.git - Set the
Dependency Ruleto beExact Versionwith version1.2.0 - Select
Add Package.
dependencies: [
.package(url: "https://github.com/Woopra/Woopra-iOS.git", from: "1.2.0")
]Then, add the dependency to your target:
targets: [
.target(
name: "YourAppName",
dependencies: [
.product(name: "Woopra", package: "Woopra-iOS")]
)
]import WoopraWhen the app loads, you should load the Woopra Tracker and configure it.
WTracker.shared.domain = "mybusiness.com"You can update your idle timeout (default: 60 seconds) by updating the timeout property in your WTracker instance:
WTracker.shared.idleTimeout = 30To track an appview event:
// create event "appview"
let event = WEvent.event(name: "appview")
// add property "view" with value "login-view"
event.add(property: "view", value: "login-view")
// track event
WTracker.shared.trackEvent(event)To add custom visitor properties, you should edit the visitor object.
WTracker.shared.visitor.add(property: "name", value: "John Smith")
WTracker.shared.visitor.add(property: "email", value: "[email protected]")You can then send an identify call without tracking an event by using the push method:
WTracker.shared.push()