This example shows a Track event embedded into an alert dialog and triggered once the OK button is clicked. The Track event part of the code is bolded.
See here for general information about Track Events.
Android
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_dialog_1:
new AlertDialog.Builder(getContext())
.setMessage(getString(R.string.main_dialog_simple_title))
.setPositiveButton(getString(R.string.dialog_ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Pendo.track("OK_Track", null);
}
})
.show();
break;
iOS
let otherAction = UIAlertAction(title: otherButtonTitle, style: .default) { _ in
NSLog("The \"Secure Text Entry\" alert's other action occured.")
PendoManager.shared().track("OK_Track", properties: nil)
removeTextFieldObserver()
}
The Track events are collected by Pendo instantly and are displayed first as Raw events in Settings > Subscription Settings > You app > Raw Events.
Up to an hour after, the Track events are displayed as aggregated data and are shown in the UI. To view the Track Events, go to Product > Track Events and change the time filter to Today to see today’s results.