# Quick Start with Google Admob
This walkthrough shows how to show Google Admob's Native Ads in story format with Storyly in your iOS application.
You can also check out the demo on GitHub
Before you begin
This walkthrough contains sample instance information. However, if you want to work with your own content as well, please login into Storyly Dashboard (opens new window) and get your instance token.
The sample instance information for testing purposes;
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhY2NfaWQiOjc2MCwiYXBwX2lkIjo0MDUsImluc19pZCI6NDA0fQ.1AkqOy_lsiownTBNhVOUKc91uc9fDcAxfQZtpm3nj40
Also, you need to update required settings from Storyly Dashboard Ad Settings (opens new window) to enable Ads in the instance.
Before you begin
Please check Google AdMob Mobile Ads SDK(iOS) Quick Start Guide (opens new window) for correct integration.
You need to create a Native Ad Unit Id (opens new window) or for testing purposes use Test Ads (opens new window)
# Installation
WARNING
Storyly Monetization SDK targets iOS 10
or higher.
# CocoaPods
Storyly Monetization SDK is available through CocoaPods (opens new window). CocoaPods is a dependency manager for Cocoa projects. To integrate Storyly Monetization SDK into your Xcode project using CocoaPods, specify it in your Podfile
:
use_frameworks!
pod 'StorylyMonetization'
Then run pod install
.
WARNING
Please note that CocoaPods (opens new window) version should be 1.9+
# Carthage
Storyly Monetization SDK is available through Carthage (opens new window). To integrate Storyly Monetization SDK into your Xcode project using Carthage, specify it in your Cartfile
:
binary "https://prod-storyly-media.s3.eu-west-1.amazonaws.com/storyly-monetization-sdk/Carthage/StorylyMonetization.json"
binary "https://prod-storyly-media.s3.eu-west-1.amazonaws.com/storyly-sdk/Carthage/Storyly.json"
binary "Carthage/GoogleMobileAds.json" == 9.11.0
Then run carthage update --use-xcframeworks
.
After, add the frameworks to your Xcode project: Go to targets and select your application. Click plus button from the Frameworks, Libraries, and Embedded Content
section and add StorylyMonetization.xcframework
, Storyly.xcframework
and GoogleMobileAds xcframeworks
. If you can't find, add from Add Other > Add files
dialog. Frameworks will be located at Carthage/Build/
.
WARNING
Please note that a custom solution is required to support GoogleMobileAds with Carthage. This walkthrough's setup contains GoogleMobileAds.json file in Carthage folder with following content;
{
"9.11.0": "https://dl.google.com/googleadmobadssdk/googlemobileadssdkios.zip"
}
WARNING
Please note that Carthage (opens new window) version should be 0.38+
# Initialize StorylyAdProvider
You need to import related modules to use StorylyMonetization:
import StorylyMonetization
@import StorylyMonetization;
You need to set a StorylyAdProvider
to your StorylyView
instance to enable monetization feature.
self.storylyView.storylyAdViewProvider = StorylyAdViewProvider(rootViewController: self,
adMobAdUnitId: ADMOB_NATIVE_AD_ID)
self.storylyView.storylyAdViewProvider = [[StorylyAdViewProvider alloc] initWithRootViewController:self
adMobAdUnitId:ADMOB_NATIVE_AD_ID
adMobAdExtras:NULL];
Just hit the run. Now, you should be able to enjoy Storyly
with ads 🎉!
# Google AdMob Consent Management
Before you begin
You may check Forward consent to the Google Mobile Ads SDK (opens new window) documentation for details.
StorylyAdViewProviders
provides a parameter, named adMobAdExtras
, in its constructor to pass additionalParameters
to Google AdMob.