Tracking in iOS Applications
This guide explains how to integrate Roivenue Tracking into your iOS app to measure key user actions such as page views and conversions (e.g., purchases or custom goals).
Prerequisites
Xcode 15+
Swift 5.9+
Network permissions (internet access)
A valid Roivenue propertyId (UUID)
What the Tracking API Expects
The Roivenue endpoint accepts events in JSON format. Each event represents a user interaction and includes basic context (timestamp, device info, URL, etc.) plus optional conversion data.
{
"propertyId": "adbfb3aa-xxxx-xxxx-xxxx-xxxxxxxx",
"type": "pageview",
"timestamp": "2024-10-30T07:50:40",
"url": "https://example.com/?utm_source=facebook",
"deviceId": "20904e-f1e3-79f2-b5b7-00d6a7bfe57e",
"userId": "someUserHashed",
"referer": "$direct",
"screenWidth": 1170,
"screenHeight": 2532,
"utmSource": "facebook",
"utmMedium": "cpc",
"utmCampaign": "autumn_sale",
"conversionType": "purchase",
"conversionId": "ORD-001",
"conversionValue": 149.99,
"currencyCode": "EUR"
}Implementation Overview
Youβll build a single reusable RoivenueTracker Swift class:
Automatically collects device metadata
Sends pageview events when views appear
Sends conversion events with purchase details
Capturing and Managing UTM Parameters
When the app is opened via a universal link or deep link, UTM parameters can be passed in the URL. Roivenue tracking uses these UTMs to attribute events to the correct marketing source.
Step 1 β Create the UTM Manager
Create a helper class to extract, store, and clear UTM parameters. (You might already have something similar).
Step 2 β Hook into App Lifecycle
Reset UTMs on cold start, and store new ones when a deep link contains them.
Step 3 β Create the Tracker Class
Step 4 β Track Page Views
Step 5 β Track Conversions
Last updated
Was this helpful?