...
Transition events are detected by the single tag automatically after initialization. They happen when a
UIViewController
is started/presented from anotherUIViewController
.Button Presses when a button is pressed, this works They are presses are automatically detected by adding the
android:tag
attribute to the button.
Example of transition:
...
language | swift |
---|
single tag if the button’s
accessibilityLabel
is specified and has a corresponding configuration in the single tag data.
Example of transition:
This example demonstrates the automatic display of an interstitial ad during the transition from InitialScreenViewController
to NewsPostDetailScreenViewController
.
Primarily the transition needs to be configured via the dashboard, but for testing purposes, it could be configured locally by using SingleTagConfigBuilder.shared
instance.
Code Block |
---|
import UIKit
import R89SDK
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
addTestingSingleTagData() /* This is a later step */
R89SDK.shared.initialize(...)
return true
}
func addTestingSingleTagData(){
// Add a Screen that is a UIViewController, the screenName you can get it by logging this in you code ->
// in viewDidLoad you can use self.name ->
// on InitialScreenViewController -> InitialScreenViewController
// on NewsPostDetailScreenViewController -> NewsPostDetailScreenViewController
let screenBuilder = SingleTagConfigBuilder.shared
.addAdScreenBuilder(isFragment:false,screenName: "InitialScreenViewController")
/* trigger interstitial when we transition from "InitialScreenViewController" (ScreenBuilder.screenName) TO NewsPostDetailScreenViewController */
screenBuilder.addInterstitial(eventsToTrackTo: "NewsPostDetailScreenViewController",
eventsToTrackButton: nil)
...
}
...
} |
Hence, the interstitial ad will be displayed whenever InitialScreenViewController
presents InfiniteScrollViewController
.
Code Block | ||
---|---|---|
| ||
import UIKit
import R89SDK
class InitialScreenViewController: UIViewController {
...
override func viewDidLoad() {
super.viewDidLoad()
..
R89SDK.shared.registerLifecycle(uiViewController: self)
// Do any additional setup after loading the view.
}
@IBAction func presentNewsPostDetailScreen(_ sender: UIButton) {
// On this transition event, the interstitial ad will be displayed.
present(NewsPostDetailScreenViewController(), animated: true)
}
...
} |
Info |
---|
In this example an interstitial would be triggered when we see the |
Example of button press:
Code Block | |
---|---|
language | swifton top of |
...
Example of button press:
This example shows how an interstitial ad is automatically displayed by intercepting the button press event. After the ad is closed, the button press event is forwarded as expected.
Primarily the button-press needs to be configured via the dashboard, but for testing purposes, it could be configured locally by using SingleTagConfigBuilder.shared
instance.
Code Block | ||
---|---|---|
| ||
import UIKit
import R89SDK
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
addTestingSingleTagData() /* This is a later step */
R89SDK.shared.initialize(...)
return true
}
func addTestingSingleTagData(){
let screenBuilder = SingleTagConfigBuilder.shared
.addAdScreenBuilder(isFragment:false,screenName: "InitialScreenViewController")
...
/* trigger an interstitial when a button with this tag is pressed in "InitialScreenViewControllerj" (ScreenBuilder.screenName) */
screenBuilder.addInterstitial(eventsToTrackTo: nil,
eventsToTrackButton: "button_tag")
}
...
} |
According to the above configuration, the button_tag
must be specified inside the InitialScreenViewController
for the button via the accessibilityLabel
parameter.
...
Hereafter, the single tag will automatically trigger the display of an interstitial ad when the button press event occurs.
Code Block | ||
---|---|---|
| ||
import UIKit
import R89SDK
class InitialScreenViewController: UIViewController {
...
override func viewDidLoad() {
super.viewDidLoad()
isModalInPresentation = true
R89SDK.shared.registerLifecycle(uiViewController: self)
// Do any additional setup after loading the view.
}
// The button's press handler method
@IBAction func showNewsDetails(_ sender: UIButton) {
// This method will be called after the interstitial ad is closed.
...
}
...
} |
Info |
---|
In this example an interstitial would be triggered when the button is pressed and when the interstitial is closed the |
...