Integration

Smartlook can be easily integrated into Amplitude using Notifications:

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 {
       
    Amplitude.instance()?.logEvent("Smartlook session URL", withEventProperties: [ "session_url": sessionUrl])
    }
}

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

    let identify = AMPIdentify().add("smartlook_visitor_url", value: visitorUrl.absoluteString as NSString)
    Amplitude.instance()?.identify(identify)
  }
}

Full Amplitude documentation with examples can be found on the official website.

12591259