Skip to main content

Overview

This guide provides instructions for passing user data, such as User ID, Email, Name, and Phone Number, to the AppTrove iOS SDK. Associating user data with events enhances tracking and allows correlation with Trackier data and logs.

Prerequisites

  • iOS 10.0 or later and Xcode 12.0 or later
  • Basic knowledge of Swift and iOS development

Passing User Data

Trackier allows you to pass additional user data, such as User ID, Email, Name, and Phone Number, to the SDK. This data can be correlated with Trackier's data and logs for improved attribution and analytics.

Usage

Use the provided TrackierSDK methods to set user details before tracking an event. The following example demonstrates passing user data and triggering a LOGIN event.

UserData.swift
func userDetails() {
let event = TrackierEvent(id: TrackierEvent.LOGIN)

/* Passing the UserId and User EmailId Data */
TrackierSDK.setUserId("XXXXXXXX") // Pass user Id here
TrackierSDK.setUserEmail("abc@gmail.com") // Pass email Id
TrackierSDK.setUserName(userName: "abc") // Pass User Name
TrackierSDK.setUserPhone(userPhone: "8138933891") // Pass User Phone Number
DispatchQueue.global().async {
sleep(1)
TrackierSDK.trackEvent(event: event)
}
}

Available Methods

  • setUserId(_:): Unique user identifier.
  • setUserEmail(_:): User's email address.
  • setUserName(userName:): User's display name.
  • setUserPhone(userPhone:): User's phone number.

Best Practices

  • Set User Data Early: Pass user data as soon as it's available (e.g., after login) to ensure all subsequent events are associated with the user.
  • Use Unique Identifiers: Ensure the User ID is unique to avoid data conflicts in Trackier's logs.
  • Trigger Events Asynchronously: Use DispatchQueue.global().async to avoid blocking the main thread when tracking events.
  • Test in Development Mode: Use ENV_TESTING or ENV_DEVELOPMENT during testing to verify user data integration without affecting production data.

Troubleshooting

  • User Data Not Recorded: Ensure user data methods (e.g., setUserId) are called before tracking events.
  • Event Not Tracking: Verify the SDK is initialized and the correct event ID is used.
  • Data Mismatch: Confirm that the user data passed (e.g., User ID, Email) matches the expected format in the Trackier Panel.

For further assistance, refer to the Trackier Documentation Portal or contact Trackier support at support@trackier.com.