GithubHelp home page GithubHelp logo

isabella232 / adrevenue-apple-admob Goto Github PK

View Code? Open in Web Editor NEW

This project forked from appsflyersdk/adrevenue-apple-admob

0.0 0.0 0.0 236 KB

License: MIT License

Ruby 4.26% Objective-C 95.74%

adrevenue-apple-admob's Introduction

adrevenue-apple-admob

Integration

To integrate AdRevenue-AdMob into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'AppsFlyer-AdRevenue-AdMob'
@import AppsFlyerLib;
@import AppsFlyerAdRevenue;
@import AppsFlyerAdRevenueAdMob;

...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Setup Google Ads
    [[GADMobileAds sharedInstance] startWithCompletionHandler:nil];
    
    // Setup AppsFlyer
    [[AppsFlyerLib shared] setAppsFlyerDevKey:@"{dev-key}"];
    [[AppsFlyerLib shared] setAppleAppID:@"{apple-id}"];
    [[AppsFlyerLib shared] setIsDebug:YES];
 
    // Setup AppsFlyerAdRevenue
    [AppsFlyerAdRevenue start];
    [[AppsFlyerAdRevenue shared] setIsDebug:YES];
    //...
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [[AppsFlyerLib shared] start];
}

In your UIViewController, where you use AdMob add:

@import AppsFlyerAdRevenueAdMob;

Usage

AppsFlyerAdRevenueAdMob provides 1 api that replace the ad's setPaidEventHandler. You should use AppsFlyerAdRevenueAdMob api and NOT the ad's api:

+ (void)setPaidEventHandlerForTarget:(id)target
                            adUnitId:(NSString *)adUnitId
                        eventHandler:(AdMobEventHandler)eventHandler;

Banner

self.bannerView = [[GADBannerView alloc] initWithAdSize:GADAdSizeBanner;
//
// ...Banner configurations
//
[AppsFlyerAdRevenueAdMob setPaidEventHandlerForTarget:self.bannerView adUnitId:@"ca-app-pub-id" eventHandler:^(GADAdValue * _Nonnull value) {
        // do more actions with GADAdValue
}];

Interstitial ad

// ...Interstitial ad configurations
[AppsFlyerAdRevenueAdMob setPaidEventHandlerForTarget:interstitialAd adUnitId:@"ca-app-pub-id" eventHandler:^(GADAdValue * _Nonnull value) {
        // do more actions with GADAdValue
}];

Native ad

- (void)adLoader:(GADAdLoader *)adLoader didReceiveNativeAd:(GADNativeAd *)nativeAd {

    // <~+~ Use this api inside didReceivedNativeAd delegate ~+~>

    [AppsFlyerAdRevenueAdMob setPaidEventHandlerForTarget:nativeAd adUnitId:TestAdUnit eventHandler:^(GADAdValue * _Nonnull value) {
        // do more actions with GADAdValue
    }];
// ....
}

Rewarded ad

// ...Rewarded ad configurations
self.rewardedAd = ad;
[AppsFlyerAdRevenueAdMob setPaidEventHandlerForTarget:[self rewardedAd] adUnitId:@"ca-app-pub-id" eventHandler:^(GADAdValue * _Nonnull value) {
    // do more actions with GADAdValue       
}];

App open

// ...App open ad configurations
self->_appOpenAd = appOpenAd;
[AppsFlyerAdRevenueAdMob setPaidEventHandlerForTarget:self->_appOpenAd adUnitId:@"ca-app-pub-id" eventHandler:^(GADAdValue * _Nonnull value) {
    // do more actions with GADAdValue       
}];

adrevenue-apple-admob's People

Contributors

amit-kremer93 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.