> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.qonversion.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Launch analytics mode IOS

## 1. Launch SDK

Initialize the SDK:

```swift theme={null}
import Qonversion

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    let config = Qonversion.Configuration(projectKey: "[projectKey]", launchMode: .analytics)
    Qonversion.initWithConfig(config)
  	return true
}
```

```objectivec theme={null}
#import "Qonversion.h"
  
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    QONConfiguration *configuration = [[QONConfiguration alloc] initWithProjectKey:@"[projectKey]" launchMode:QONLaunchModeAnalytics];
    [Qonversion initWithConfig:configuration];
    
    return YES;
}
```

## 2. (Optional) Set User ID

If you want to implement cross-platform (Android, IOS, and Web) user entitlement management, please, follow the [User Identity guide](/docs/user-identifiers#3-user-identity).

To match Qonversion revenue events to users in <a href="/docs/integrations-overview" target="_blank" rel="noopener">third-party tools</a>, you need to set the identical user IDs in all of them:

```swift theme={null}
Qonversion.shared().setProperty(.userID, value: "yourSideUserId")
```

```objectivec theme={null}
[[Qonversion sharedInstance] setProperty:QNPropertyUserID value:@"yourSideUserId"];
```

The user ID improves the quality of events matching to the platforms where event attribution is not exclusively based on IDFA.

## 3. (Optional) Set IDFA (Identifier for Advertisers, iOS 14.5+ only)

On iOS 14.5+, after requesting the app tracking permission using ATT, you need to notify Qonversion if tracking is allowed and IDFA is available. This will help to have precise attribution in Adjust, AppsFlyer, Singular and other <a href="/docs/integrations-overview" target="_blank" rel="noopener">Qonversion integrations</a>.

```swift theme={null}
ATTrackingManager.requestTrackingAuthorization { status in
    switch status {
    case .authorized:
        Qonversion.shared().collectAdvertisingId()
      
    // handle other states below
    }
}
```

```objectivec theme={null}
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
    switch (status) {
        case ATTrackingManagerAuthorizationStatusAuthorized:
            [[Qonversion sharedInstance] collectAdvertisingId];
            break;
        
        // handle other states if needed
        
        default:
          break;
    }
}];
```
