Create a No Action Handler

In some cases when you trigger an action, you might want to discard the collected data and do nothing. In these cases, you can direct the getActions or getActionsData method to perform no action. No data is returned in this case.

Full Code Example

Complete code example blocks are listed below.

import MarqueeLabel
import UIKit
import monetate_ios_sdk

class CategoryViewController: UIViewController {
  final var objPersonalization = Personalization(
    account: Account(
      instance: "p", domain: "localhost.org", name: "a-701b337c", shortname: "localhost"),
    user: User(deviceId: "62bd2e2d-213d-463f-83bb-12c0b2530a14"))
  override func viewDidLoad() {
    super.viewDidLoad()
  }
  override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    noActionEvent()
  }
  func noActionEvent() {
    objPersonalization.getActions(
      context: .PageView, requestId: "test_request_id",
      includeReporting: true,
      arrActionTypes: ["monetate:action:NoAction"],
      event: PageView(
        pageType: "Homepage", path: "n/a", url: "n/a",
        categories: [], breadcrumbs: [])
    ).on { (res) in
      if res.status == 200 {
        let data = JSON(res.data)
        print(data)
        self.handleAction(res: res)
      } else {
      }
    }
  }
}