Skip to main content

Mobile Popup iOS

Configuration on Mobile Data Campaign

NameDetailExample
titleTextTitleRecommend Campaign
subtitleTextSubtitleSee Details with the button below
titleColorTitle Color#333333 (HEX, RGBA ,etc)
titleFontSizeTitle Font Size30px
bannerUrlImage Pathhttps://****.jpg
closeButtonTextClose Button TextClose
linkButtonTextLink Button TextSee Details
linkButtonUrlLink Button URLhttps:// or app://

※ Set these properties of Mobile Data Campaign

Installation Step

  1. Set Mobile Data Campaign with the documentation
  2. Open the file downloaded on the top page
  3. Place popup.html and PopupController.swift from mobile > popup > ios to the local directory
  4. Add the code below inside ViewController file
func handlePopupCampaign(campaign: EVGCampaign) {
// Popup
let popup = CustomPopupController(
webViewFile: "popup",
titleText: (campaign.data["titleText"] as! String),
titleColor: campaign.data["titleColor"] as? String,
titleFontSize: campaign.data["titleFontSize"] as? String,
subtitleText: campaign.data["subtitleText"] as! String,
bannerUrl: campaign.data["bannerUrl"] as! String,
buttonUrl: campaign.data["linkButtonUrl"] as? String,
buttonText: campaign.data["linkButtonText"] as? String,
closeButtonText: campaign.data["closeButtonText"] as? String
)

let cancelAction = CustomPopupAction(handler: {_ in })
popup.addAction(cancelAction)
popup.modalPresentationStyle = .overFullScreen
popup.modalTransitionStyle = .crossDissolve
present(popup, animated: true)
// / Popup

evergageScreen?.trackImpression(campaign)

// Only display the campaign if the user is not in the control group.
if (!campaign.isControlGroup) {
NSLog("New active campaign name %@ for target %@ with data %@",
campaign.campaignName, campaign.target, campaign.data)
}
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

// Pass the data of Mobile Data Campaign to handlePopupCampaign method
let handlerPopup = { [weak self] (campaign: EVGCampaign) -> Void in
self?.handlePopupCampaign(campaign: campaign)
}
// Here it sets "App Foreground" to trigger Mobile Data Campaign
evergageScreen?.trackAction("App Foreground")
evergageScreen?.setCampaignHandler(handlerPopup, forTarget: "the value you set as Target")

refreshScreen()
}

Preview