Heap

Automatic integration

Smartlook can be automatically integrated into Heap by using the following:

Heap.initialize("YOUR_HEAP_API_KEY")

let smartlookConfiguration = Smartlook.Configuration.configuration(key: "YOUR_SMARTLOOK_API_KEY")
smartlookConfiguration.enableIntegrations = [ Smartlook.HeapIntegration(integrationWith: Heap.self) ]

Smartlook.setupAndStartRecording(configuration: smartlookConfiguration)
[Heap initialize:@"YOUR_HEAP_API_KEY"];

SLSetupConfiguration *configuration = [SLSetupConfiguration configurationWithKey:@"YOUR_SMARTLOOK_API_KEY"];
configuration.enableIntegrations = @[ [SLHeapIntegration alloc] initIntegrationWith:[Heap class]] ];

[Smartlook setupAndStartRecordingWithConfiguration:configuration];

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

562562

Manual integration

Smartlook can be easily integrated into Heap using Notifications:

NotificationCenter.default.addObserver(forName: Smartlook.dashboardSessionURLChanged, object: nil, queue: nil) { (note) in
    if let currentSessionUrl = Smartlook.getDashboardSessionURL(withCurrentTimestamp: false) {
        Heap.track("Smartlook session URL", withProperties: [ "session_url": currentSessionUrl.absoluteString ])
    }
}

NotificationCenter.default.addObserver(forName: Smartlook.dashboardVisitorURLChanged, object: nil, queue: nil) { (note) in
    if let currentVisitorUrl = Smartlook.getDashboardVisitorURL() {
        Heap.addUserProperties([ "smartlook_visitor_url": currentVisitorUrl.absoluteString ])
    }
}
[[NSNotificationCenter defaultCenter] addObserverForName:SLDashboardSessionURLChangedNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
    NSURL *currentSessionURL = [Smartlook getDashboardSessionURLWithCurrentTimestamp:NO];
    if (currentSessionURL != nil) {
        [Heap track:@"Smartlook session URL" withProperties:@{ @"session_url" : currentSessionURL.absoluteString}];
    }
}];

[[NSNotificationCenter defaultCenter] addObserverForName:SLDashboardVisitorURLChangedNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
    NSURL *currentVisitorURL = [Smartlook getDashboardVisitorURL];
    if (currentVisitorURL != nil) {
        [Heap addUserProperties:@{ @"smartlook_visitor_url" : currentVisitorURL.absoluteString}];
    }
}];

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