Heap

Integration

Smartlook can be easily integrated into Heap 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 {
       
        Heap.track("Smartlook session URL", withProperties: [ "session_url": sessionUrl.absoluteString ])
 	}
}

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

      Heap.addUserProperties([ "smartlook_visitor_url": visitorUrl.absoluteString ])
  }
}

A Smartlook visitor URL will be added as a new property called the Smartlook visitor dashboard URL into a Heap user.

562

Full Heap API documentation can be found on the official website.