Dashboard URLs

Pre API 2.0

let sessionUrl = Smartlook.getDashboardSessionURL()
let sessionUrlWithTimestamp = Smartlook.getDashboardSessionURL(withCurrentTimestamp: true)
let visitorUrl = Smartlook.getDashboardVisitorURL()

Observing URLs changes:

NotificationCenter.default.addObserver(forName: Smartlook.dashboardSessionURLChanged, object: nil, queue: nil) 
{ (note) in
  if let currentSessionUrl = Smartlook.getDashboardSessionURL(withCurrentTimestamp: false) {
 
    // process the session url change
  }
}

NotificationCenter.default.addObserver(forName: Smartlook.dashboardVisitorURLChanged, object: nil, queue: nil) 
{ (note) in
  if let currentVisitorUrlString = Smartlook.getDashboardVisitorURL()?.absoluteString {
  
    // process the user url change
  }
}

API 2.0

let sessionUrl = Smartlook.instance.user.session.url
let sessionUrl = Smartlook.instance.user.session.urlWithTimestamp

let sessionUrl = Smartlook.instance.user.url

Observing URLs changes:

NotificationCenter.default.addObserver(forName: Session.urlDidChangeNotification, object: nil, queue: nil) 
{ notification in
    if let smartlook = notification.object as? Smartlook,
         let sessionUrl = smartlook.user.session.url {

        // process the URL change
  }
}

NotificationCenter.default.addObserver(forName: User.urlDidChangeNotification, object: nil, queue: nil) 
{ notification in
    if let smartlook = notification.object as? Smartlook {
    let visitorUrl = smartlook.user.url

    // process the URL change
  }
}

Session URL documentation.