...
Code Block | ||
---|---|---|
| ||
class ViewControllerInitialScreenViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() R89SDK.shared.setLogLevel(level: LogLevels.debug) R89SDK.shared.setDebug() addTestingSingleTagData() /* This is a later step */ R89SDK.shared.initialize(publisherId: "TestRefinery89ID", appId: "TestConfigDemoApp", singleLine: true, publisherInitializationEvents: nil) R89SDK.shared.registerLifecycle(uiViewController: self) } } } |
...
Then on every UIViewController
viewDidLoad()
add the following line.
Code Block | ||
---|---|---|
| ||
class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() R89SDK.shared.registerLifecycle(uiViewController: self) } } } |
...
Check iOS Creating a wrapper if you want to know more details on how to create a normal wrapper.
Events
Events can trigger other formats, right now the single tag supports:
Transitions events are detected by the single tag automatically after initialization. They happen when an activity or fragment is started from other activity or fragment.
Button Presses when a button is pressed, this works They are detected by adding the
android:tag
attribute to the button.
Example of transition:
Code Block | ||
---|---|---|
| ||
Info |
---|
In this example an interstitial would be triggered when we see the |
...
Example of button press:
Code Block | ||
---|---|---|
| ||
Info |
---|
In this example an interstitial would be triggered when the button is pressed and when the interstitial is closed the |
...
Adding testing single tag data
Go back to the UIViewController
class where we initialized the code, we are going to test all the transitions, tagged wrappers and tagged buttons you have placed in the app.
Before initialization method we called addTestingSingleTagData()
that uses the SingleTagConfigBuilder
to create the testing data needed for debugging the sdk.
More info in → https://refinery89.atlassian.net/wiki/x/EgBWTw
Note |
---|
When using the |
Code Block | ||||
---|---|---|---|---|
| ||||
func addTestingSingleTagData(){
SingleTagConfigBuilder.shared.addAdScreenBuilder(isFragment:false,screenName: "InitialScreenViewController")
.addBanner(wrapperTag: "banner_tag",
getAllWithTag: true,
wrapperRelativePositionInside: true,
wrapperRelativePositionAfter: false)
.addInterstitial(eventsToTrackTo: nil, eventsToTrackButton: "button_tag")
.addInterstitial(eventsToTrackTo: "SecondSCreenViewController", eventsToTrackButton: nil)
} |
Note |
---|
This step is for testing purposes and you are only going to see test ads when using this approach, but this is very helpful to us if you provide this peace of code to tell us where you want to place the ads. Later when in production, this code have been removed and you have hopefully added flexible tagged wrappers and tagged all the button as possible so we can change your ad slots from the server without the need of updating the app. |
Go into production
For going into production you will need to use you ids:
Remove the methods
R89SDK.shared.setDebug()
andaddTestingSingleTagData()
Change the App id in the info.plist for the production one
Change the
appId
andpublisherId
in the initialization method for the production onesit’s also recommended to remove
R89SDK.shared.setLogLevel(LogLevels.DEBUG)
but not needed
How does it works?
We monitor your app to determine the active screen at any given moment. For each screen, we maintain a record of events and tags that you have supplied, enabling us to place ads in those tagged views or during specific transitions and events from the record.
We have the capability to display Display ads on a tagged wrappers or trigger an Interstitial ads during the transition from one screen to another or in button press. And many other things All of this can be achieved without the need of coding specific triggers or manually adding the ad to the view. It is as simple as initializing the SDK.