# 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

Storyly Demo for Swift (opens new window)

Storyly Demo for Objective-C (opens new window)

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 you need to use Storyly with use_frameworks! option in Podfile. If you need to add it without using use_frameworks! option, add following lines to your Podfile before updating Pods or check Manual Installation.

dynamic_frameworks = ['StorylyMonetization', 'Storyly', 'SDWebImage']
pre_install do |installer|
  installer.pod_targets.each do |pod|
    if dynamic_frameworks.include?(pod.name)
      def pod.dynamic_framework?;
        true
      end
      def pod.build_type;
        Pod::BuildType.dynamic_framework
      end
    end
  end
end

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" == 8.7.0
github "SDWebImage/SDWebImage" == 5.10.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, SDWebImage.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;

{
	"8.7.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:

    You need to set a StorylyAdProvider to your StorylyView instance to enable monetization feature.

      Just hit the run. Now, you should be able to enjoy Storyly with ads 🎉!