Event Tracking
Record defined user interactions in your iOS app with a single SDK call.
Overview
The Sees360 iOS SDK provides the track method for recording defined user interactions within an application.
Tracking events can be used for actions such as:
- Tapping a button
- Opening a displayed deal
- Interacting with promotional content
- Other application-specific user actions
Each tracking event is registered against a project in Sees360 before it is used in the application.
Registering a tracking event
Tracking events are created in the Sees360 web application. Open the Tracking Events section for the required project and enter a short description of the action you want to track, for example Compare button tapped.
Sees360 automatically generates the event identifier user_compare_button_tapped, and the Tracking Events page displays the corresponding SDK call:
Sees360.track(name: "user_compare_button_tapped")
Tracking an event
Once an event has been registered, call track when the relevant user interaction occurs:
Sees360.sharedInstanceIfInitialized()?.track(name: "user_compare_button_tapped")
For example:
@IBAction func compareButtonTapped(_ sender: UIButton) {
Sees360.sharedInstanceIfInitialized()?.track(name: "user_compare_button_tapped")
openComparison()
}
The name passed to track must match the identifier registered for the project. It’s also checked locally against ^user_[a-z_]+$ before being queued — this only rejects obviously malformed input, it isn’t proof the name is actually registered (see Registered events below).
UIKit
For a standard UIKit control:
let compareButton = UIButton(type: .system)
compareButton.addTarget(self, action: #selector(compareButtonTapped), for: .touchUpInside)
@objc func compareButtonTapped() {
Sees360.sharedInstanceIfInitialized()?.track(name: "user_compare_button_tapped")
openComparison()
}
SwiftUI
track can be called directly from a SwiftUI action:
Button {
Sees360.sharedInstanceIfInitialized()?.track(name: "user_compare_button_tapped")
openComparison()
} label: {
Text("Compare")
}
No additional SwiftUI integration is required for tracking events.
WebView tracking
Tracking events can also be triggered from JavaScript running within an iOS WKWebView.
First attach the Sees360 JavaScript bridge to the web view:
Sees360.attachJavascriptBridge(webView)
For example:
import WebKit
let webView = WKWebView()
Sees360.attachJavascriptBridge(webView)
webView.load(URLRequest(url: url))
JavaScript running in the web view can then call:
Sees360.track("user_compare_button_tapped");
This allows web-based areas of an application to use the same registered tracking events as native iOS code. Attach the bridge before loading any content into the web view — attaching it after a page has already loaded doesn’t retroactively add it to that page.
Only attach the JavaScript bridge to WebViews containing content that the application trusts. Like Android’s addJavascriptInterface, the bridge is exposed to every frame on the page, including third-party iframes, not just the top-level page.
Registered events
The Sees360 API only accepts tracking events that have been registered against the current project.
For example, if the project contains user_compare_button_tapped, then Sees360.sharedInstanceIfInitialized()?.track(name: "user_compare_button_tapped") can be recorded. An arbitrary event such as Sees360.sharedInstanceIfInitialized()?.track(name: "user_something_not_registered") will not be accepted by the Sees360 API.
Developers should therefore use the event identifier displayed on the project’s Tracking Events page.
An unregistered event isn’t rejected immediately — it’s queued locally, attempted, and permanently dropped on a 404, with no error surfaced to the application. There is no delivery confirmation or error callback from track; treat every call as fire-and-forget, and confirm new event names are registered in the Sees360 dashboard before relying on them in production.
Enabling and disabling events
Tracking events can be enabled or disabled from the Sees360 web application.
An enabled event can be received and recorded normally. If an event is disabled, calls using that event identifier will no longer be accepted by the Sees360 API. This allows an event to be retired without requiring its definition to be deleted.
Analytics consent
Tracking events respect the SDK’s analytics consent setting. Consent can be enabled and disabled with:
Sees360.sharedInstanceIfInitialized()?.setAnalyticsConsent(granted: true)
Sees360.sharedInstanceIfInitialized()?.setAnalyticsConsent(granted: false)
When analytics consent is disabled, calls to track are ignored and the event is not added to the tracking queue. Applications should apply their stored analytics-consent choice after initializing the SDK.
See Analytics Consent for the full opt-in/opt-out flow, including persisting and reapplying the user’s choice.
Event delivery
When a valid registered event is tracked, the SDK handles delivery to Sees360. A tracking request contains the registered name:
{
"tracking_event": {
"slug": "user_compare_button_tapped"
}
}
On receipt, Sees360 verifies that the event:
- Belongs to the project
- Is registered
- Is currently enabled
If accepted, it is recorded as an analytics event using the tracking-event name as the event name (e.g., user_compare_button_tapped). No custom event payload is required.
No custom payload
The tracking API intentionally accepts only the registered event identifier:
Sees360.sharedInstanceIfInitialized()?.track(name: "user_compare_button_tapped")
Developers do not need to provide arbitrary event data such as labels, URLs, IDs, or custom payloads. This keeps the definition of each event consistent between applications and platforms.
track vs. screen-view tracking
track is used for defined user interactions. Screen views are handled separately by the SDK’s screen-view tracking functionality, for example:
- User views Compare Deals screen: screen-view tracking
- User taps Compare:
Sees360.sharedInstanceIfInitialized()?.track(name: "user_compare_button_tapped")
Refer to Screen-View Tracking (UIKit) and Screen-View Tracking (SwiftUI) for information about screen tracking.
Recommended workflow
The recommended workflow is:
- Decide which application interaction should be measured.
- Register the interaction from the project’s Tracking Events page in Sees360.
- Enter a short human-readable description, such as
Compare button tapped. - Sees360 generates an identifier:
user_compare_button_tapped. - Copy the generated SDK call:
Sees360.sharedInstanceIfInitialized()?.track(name: "user_compare_button_tapped"). - Add the call at the point where the interaction occurs.
- Ensure the tracking event remains enabled in Sees360.
This keeps tracking-event definitions controlled centrally while keeping the application integration intentionally simple.