So, you’ve decided to monetize your app with Vungle mobile video ads?
At this point you may be wondering, what do I need to plan? What changes will I need to make to my app? How much time will I need? How difficult is it going to be?
I’d like to say I can answer all those questions (and more!) in a single blog post, but I can’t – at least not specifically for your application. What I can do is present for you a step-by-step example of how to get Vungle mobile video monetization up and running in a real life application in less than 15 minutes.
The real life application I had in mind is 2048, a very popular single player puzzle game that skyrocketed to popularity early last year. It was not built in a monetization-first mindset, but many apps aren’t. And, while there are plenty of advantages to be gained by designing monetization into an app from day one, leaving it to the end isn’t going to slow us down.
To get started, we’ll use an open source clone of 2048 borrowed from GitHub.
There are 5 steps that I’ve got in mind, none of them take longer than a minute or two, and most will take considerably less if you’re already familiar with file and project navigation in Xcode.
By the way, for more details on the process, you can head over to our iOS Developer Guide Documentation any time.
2. Add the Vungle framework to the XCode Project – After we extract everything, we can drag & drop the VungleSDK.embeddedFramework directory into XCode under Frameworks.
3. Add other required frameworks – We require a few other native frameworks to properly show mobile video ads, so we’ll add those under the the project’s General settings. There are 14 native frameworks that we’ll need in total, but many of them are already included by the project, so it will only take a minute or two to finish adding everything.
4. Remove the iOS Status Bar – This isn’t a required step, but it is recommended as keeping the status bar at bay ensures that the Vungle ad interaction and presentation perform smoothly. To do this we simply add a new key/value to our info.plist.
5. Add the Code! – Here’s the best part. The configuration is done and we’re into the meat of things – only a few lines of code away from mobile video monetization! There are just two quick steps to this part:
a. Initialize the SDK – The sooner we can initialize the SDK the faster we can start pre-caching an in-app ad for the user. We pre-cache to make sure that the user’s ad experience isn’t jumpy or pixelated. We want a seamless video experience for everyone, so we’ll initialize the VungleSDK during the project’s didFinishLaunchingWithOptions method.
Ads in the ViewController – We don’t want to interrupt the game flow, so let’s present an advertisement when the user finishes a game (congratulations, you won!) or when the user wants to restart a game that isn’t going too well. We’ll add this into the M2ViewController during the restart method.
And that’s it! Our project is monetized! Here’s how it might look:
We’re always looking for ways to make our tools easier to use and faster to implement, so shoot us an email at editorial at Vungle dot com at if you’ve got some improvements you’d love to see added! And if you’re interested in a closer look at the source code for this project, we’ve got it here.