Mobile Popup iOS
Configuration on Mobile Data Campaign
Name | Detail | Example |
---|---|---|
titleText | Title | Recommend Campaign |
subtitleText | Subtitle | See Details with the button below |
titleColor | Title Color | #333333 (HEX, RGBA ,etc) |
titleFontSize | Title Font Size | 30px |
bannerUrl | Image Path | https://****.jpg |
closeButtonText | Close Button Text | Close |
linkButtonText | Link Button Text | See Details |
linkButtonUrl | Link Button URL | https:// or app:// |
※ Set these properties of Mobile Data Campaign
Installation Step
- Set Mobile Data Campaign with the documentation
- Open the file downloaded on the top page
- Place
popup.html
andPopupController.swift
frommobile
>popup
>ios
to the local directory - 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()
}