Gleap
Search…
⚑
Custom actions
We know that the built in actions (Bug Reporting, Feature Requests, Ratings & Contact Us) might not be enough for certain use cases. For these situations we offer custom actions, which allow you to start any custom action by code.

Configure a custom action

The first step with custom actions is to open the visual widget configurator and select "Custom action" as action type.
Now you need to set a name for your custom action. Choose any name you like (it's however important that this name matches the name you check in the next step).
Setup custom actions in the Gleap dashboard.

Custom action callback

Once you've set a custom action in the Gleap dashboard, it will be called automatically on selection through the user. In order to perform custom code, simply implement our GleapDelegate to receive the custom action events.

Add & implement the Gleap delegate

The following code sample shows how to implement the GleapDelegate protocol.
1
import Foundation
2
import UIKit
3
import Gleap
4
​
5
// Add the GleapDelegate protocol to your view controller
6
class DemoViewController: UIViewController, GleapDelegate {
7
8
override func viewDidLoad() {
9
// Assign self to the delegate
10
Gleap.sharedInstance().delegate = self;
11
}
12
13
// Add the custom action called implementation
14
func customActionCalled(_ customAction: String) {
15
if (customAction == "MAGIC_ACTION") {
16
print("Magic action got called.")
17
}
18
}
19
}
Copied!
The custom action name is defined by you in the visual widget configurator on the Gleap dashboard.
Last modified 1mo ago