CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To 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.1'
end
Then, run the following command:
$ pod install
- Add a package by selecting
File
→Add Package Dependencies...
in Xcode’s menu bar. - Search for the
WoopraSDK
using the repo's URL:https://github.com/Woopra/Woopra-iOS.git
- Set the
Dependency Rule
to beExact Version
with version1.2.1
- Select
Add Package
.
dependencies: [
.package(url: "https://github.com/Woopra/Woopra-iOS.git", from: "1.2.1")
]
Then, add the dependency to your target:
targets: [
.target(
name: "YourAppName",
dependencies: [
.product(name: "Woopra", package: "Woopra-iOS")]
)
]
import Woopra
When the app loads, you should load the Woopra Tracker and configure it.
WTracker.shared.domain = "mybusiness.com"
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()
To add referrer information, timestamp, and other track request properties, look at the WoopraTracker
and WoopraEvent
class public methods for an exhaustive list of setter methods. Here are some common examples:
To add referrer information, set the referer property in your WTracker instance:
WTracker.shared.referer = <REFERRER_STRING>
You can update your idle timeout (default: 5 minutes) by updating the timeout property in your WTracker instance:
WTracker.shared.idleTimeout = 300
Note
The idle timeout is in seconds.