> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-sdk-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Session and Source Tracking

From [SDK Version 5.2.2](/developer-guide/release-notes/ios-sdk/2023-and-older) we have started supporting Session and Source Tracking, and this is enabled by default in the SDK.

<Info>
  **Note**

  * To view Session And Source information tracked in the dashboard, get the same enabled by contacting the MoEngage support team.
  * To track source information accurately, make use of the UTM parameters in your deep links and push notification payloads.
</Info>

# Capture Deep-link Source

<Info>
  **AppDelegate Swizzling**

  Calling of [*processURL(\_:)*](https://moengage.github.io/ios-api-reference/Classes/MoEngageSDKAnalytics.html#/c:@M@MoEngageAnalytics@objc\(cs\)MoEngageSDKAnalytics\(im\)processURL:) method is not required if AppDelegate Swizzling is enabled for SDK. For more info on AppDelegate Swizzling, refer to this [link](/developer-guide/ios-sdk/push/basic/ios-push-integration-tutorial##app-delegate-method-swizzling).
</Info>

For capturing source information via the deep-link call [*processURL(\_:)*](https://moengage.github.io/ios-api-reference/Classes/MoEngageSDKAnalytics.html#/c:@M@MoEngageAnalytics@objc\(cs\)MoEngageSDKAnalytics\(im\)processURL:) method in all the AppDelegate callbacks that you receive when a link is opened, please refer to the code block below.

<CodeGroup>
  ```swift Swift wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
  //MARK:- Deeplinks Processing
  func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
      MoEngageSDKAnalytics.sharedInstance.processURL(url)
      //rest of the implementation
      return true
  }

  func application(_ application: UIApplication,
                   continue userActivity: NSUserActivity,
                   restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
  {
      if userActivity.activityType == NSUserActivityTypeBrowsingWeb ,
          let incomingURL = userActivity.webpageURL{
          MoEngageSDKAnalytics.sharedInstance.processURL(incomingURL)
      }
      //rest of the implementation
      return true;
  }

  //MARK:- Methods Deprecated from iOS9

  func application(_ application: UIApplication, handleOpen url: URL) -> Bool {
      MoEngageSDKAnalytics.sharedInstance.processURL(url)
      //rest of the implementation
      return true
  }

  func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
      MoEngageSDKAnalytics.sharedInstance.processURL(url)
      //rest of the implementation
      return true
  }
  ```
</CodeGroup>

# Non-Interactive Event

Events that should not affect the session duration calculation in anyways in MoEngage Analytics should be marked as a Non-Interactive event.

These events:

* Do not start a new session, even when the app is in the foreground
* Do not extend the session
* Do not have information on source and session

For example, events that are tracked when the app is in the background to refresh the app content, are not initiated by users and hence can be marked as non-interactive. To mark an event as non-interactive use [*setNonInteractive()*](https://moengage.github.io/ios-api-reference/Classes/MoEngageProperties.html#/c:@M@MoEngageAnalytics@objc\(cs\)MoEngageProperties\(im\)setNonInteractive) method of [*MoEngageProperties*](https://moengage.github.io/ios-api-reference/Classes/MoEngageProperties.html) while tracking the event as shown below:

<CodeGroup>
  ```swift Swift wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
  //Set Attributes 
  let dict = ["NewsCategory":"Politics"]
  let properties = MoEngageProperties(withAttributes: dict)
  properties.addDateAttribute(Date(), withName:"refreshTime")

  //Set the Event as Non-Interactive
  properties.setNonInteractive()

  //Track event
  MoEngageSDKAnalytics.sharedInstance.trackEvent("App Content Refreshed", withProperties: properties)
  ```

  ```objective-c Objective C wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
  //Set Attributes
  NSMutableDictionary *eventDict = [NSMutableDictionary dictionary];
  eventDict[@"NewsCategory"] = @"Politics";
  MoEngageProperties* properties = [[MoEngageProperties alloc] initWithAttributes:eventDict];
  [properties addDateAttribute:[NSDate date] withName:@"refreshTime"];

  //Set the Event as Non-Interactive
  [properties setNonInteractive];

  //Track event
  [[MoEngageSDKAnalytics sharedInstance] trackEvent:@"App Content Refreshed" withProperties:properties];
  ```
</CodeGroup>
