CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate WoopraSDK into your Xcode project using CocoaPods, please, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'Woopra-iOS'
end
Then, run the following command:
$ pod install
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate Woopra iOS SDK into your Xcode project using Carthage, specify it in your Cartfile
:
github "Woopra/Woopra-iOS"
Run carthage update
to build the framework and drag the built WoopraSDK.framework
into your Xcode project.
To integrate WoopraSDK into your project using the Swift Package Manager, add the following as a dependency in your Package.swift
file:
dependencies: [
.package(url: "https://github.com/Woopra/Woopra-iOS.git", from: "1.1.0")
]
Then, add WoopraSDK
as a dependency for your target:
targets: [
.target(
name: "YourAppName",
dependencies: ["WoopraSDK"]),
]
import WoopraSDK
When 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 = 30
To 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()