Skip to content

Commit 7643a39

Browse files
Update adapters to be compatible with the Smart Display SDK v6.10
1 parent e9ec8b0 commit 7643a39

9 files changed

+55
-55
lines changed

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
1-
Smart AdServer - Google Ads Mobile SDK Adapter for iOS
1+
Smart AdServer - Google Mobile Ads SDK Adapter
22
==============================================
33

44
Introduction
55
------------
6-
The _Smart AdServer iOS SDK_ can be used through _Google Ads Mobile SDK (DFP)_ using the adapter provided in this repository for both _SASBannerView_ and _SASInterstitialView_.
7-
We'll be following the instructions provided by DFP [here](https://support.google.com/dfp_premium/answer/6238717?hl=en).
6+
The _Smart Display SDK_ can be used through _Google Mobile Ads SDK_ using the adapter provided in this repository for banner and interstitial. Those adapters are compatible with the _Smart Display SDK_ v6.10.
87

98
Setup
109
-----
1110

12-
To start using the _Smart AdServer iOS SDK_ through DFP, simply add all the classes included in this repository in your project (**the Xcode project needs to contain a correctly installed _Smart AdServer iOS SDK_**).
11+
1) Install the _Google Mobile Ads SDK_ according to the official documentation https://developers.google.com/admob/ios/download.
1312

14-
You can declares _SDK Mediation Creatives_ in the _DFP_ interface. Refer to the article [Add a new mobile creative](https://support.google.com/dfp_premium/answer/1209767) in Google DFP documentation for detailed instructions *Note: make sure to use "SDK Mediation" as the creative type.
13+
2) Install the _Smart Display SDK_ by adding the _pod_ `SmartAdServer-DisplaySDK` to your app _Podfile_ (more info in [the documentation](http://help.smartadserver.com/ios/V6.10/#IntegrationGuides/InstallationCocoapods.htm)).
1514

16-
To setup the _Custom Event_ (under _Ad networks_), you need to fill:
15+
3) Checkout this repository and copy the files you need into your Xcode Project:
16+
17+
- `SASGMACustomEventConstants.h` in any cases.
18+
- `SASAdView+GMA` in any cases.
19+
- `SASGMACustomEventBanner` for banner ads.
20+
- `SASGMACustomEventInterstitial` for interstitial ads.
21+
22+
4) Edit the `SASGMACustomEventConstants.h` header and replace the default base URL with your dedicated base URL.
23+
24+
5) You can now declare _SDK Mediation Creatives_ in the _Google Mobile Ads_ interface. To setup the _Custom Event_ (under _Ad networks_), you need to fill:
25+
26+
- the _Parameter_ field: set your _Smart AdServer_ IDs using slash separator `[siteID]/[pageID]/[formatID]`
27+
- the _Class Name_ field: set `SASGADCustomEventBanner` for banners or `SASGADCustomEventInterstitial` for interstitials.
1728

18-
* the _Parameter_ field: set your _Smart AdServer_ IDs using slash separator `[siteID]/[pageID]/[formatID]`
19-
* the _Class Name_ field: set `SASGADCustomEventBanner` for banners and `SASGADCustomEventInterstitial` for interstitials
2029

2130
More infos
2231
----------
23-
You can find more informations about the _Smart AdServer iOS SDK_ and the _Google Ads Mobile Mediation Adapters_ in the official documentation:
24-
http://help.smartadserver.com/en/
32+
You can find more informations about the _Smart Display SDK_ and the _Google Mobile Ads SDK_ in the official documentation:
33+
http://documentation.smartadserver.com/displaySDK

SASAdView+GAD.h renamed to SASAdView+GMA.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// SASAdView+GAD.h
2+
// SASAdView+GMA.h
33
//
44
// Created by Julien Gomez on 23/06/16.
55
// Copyright © 2016 Smart AdServer. All rights reserved.
@@ -10,7 +10,7 @@
1010
#import "SASAdView.h"
1111

1212

13-
@interface SASAdView (GAD)
13+
@interface SASAdView (GMA)
1414

1515
- (void)loadFormatWithDFPServerParameter:(NSString *)serverParameter request:(GADCustomEventRequest *)request;
1616

SASAdView+GAD.m renamed to SASAdView+GMA.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
//
2-
// SASAdView+DFPMediation.m
2+
// SASAdView+GMA.m
33
// DFPBannerExample
44
//
55
// Created by Julien Gomez on 23/06/16.
66
// Copyright © 2016 Google. All rights reserved.
77
//
88

9-
#import "SASAdView+GAD.h"
10-
#import "SASGADCustomEventConstants.h"
9+
#import "SASAdView+GMA.h"
10+
#import "SASGMACustomEventConstants.h"
1111

1212

13-
@implementation SASAdView (GAD)
13+
@implementation SASAdView (GMA)
1414

1515
- (void)loadFormatWithDFPServerParameter:(NSString *)serverParameter request:(GADCustomEventRequest *)request {
1616

1717
// Process placement ids
18-
NSArray *stringComponents = [serverParameter componentsSeparatedByString:kSASGADCustomEventServerSeparatorString];
18+
NSArray *stringComponents = [serverParameter componentsSeparatedByString:kSASGMACustomEventServerSeparatorString];
1919
NSInteger sid = 0;
2020
NSString *pid = nil;
2121
NSInteger fid = 0;
@@ -35,7 +35,7 @@ - (void)loadFormatWithDFPServerParameter:(NSString *)serverParameter request:(GA
3535
NSString *tar = [request.userKeywords componentsJoinedByString:@";"];
3636

3737
// Use location if available
38-
if(request.userHasLocation) {
38+
if (request.userHasLocation) {
3939
[SASAdView setLocation:[[CLLocation alloc] initWithLatitude:request.userLatitude longitude:request.userLongitude]];
4040
}
4141

@@ -44,4 +44,5 @@ - (void)loadFormatWithDFPServerParameter:(NSString *)serverParameter request:(GA
4444
[self loadFormatId:fid pageId:pid master:YES target:tar];
4545

4646
}
47+
4748
@end

SASGADCustomEventConstants.h

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// SASGADCustomEventBanner.h
2+
// SASGMACustomEventBanner.h
33
//
44
// Created by Julien Gomez on 21/06/16.
55
// Copyright © 2016 Smart AdServer. All rights reserved.
@@ -9,6 +9,6 @@
99
#import <GoogleMobileAds/GoogleMobileAds.h>
1010

1111

12-
@interface SASGADCustomEventBanner : NSObject<GADCustomEventBanner>
12+
@interface SASGMACustomEventBanner : NSObject<GADCustomEventBanner>
1313

1414
@end
Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
//
2-
// SASGADCustomEventBanner.m
2+
// SASGMACustomEventBanner.m
33
//
44
// Created by Julien Gomez on 21/06/16.
55
// Copyright © 2016 Smart AdServer. All rights reserved.
66
//
77

8-
#import "SASGADCustomEventBanner.h"
8+
#import "SASGMACustomEventBanner.h"
99
#import "SASBannerView.h"
10-
#import "SASAdView+GAD.h"
10+
#import "SASAdView+GMA.h"
1111

1212

13-
@interface SASGADCustomEventBanner () <SASAdViewDelegate>
13+
@interface SASGMACustomEventBanner () <SASAdViewDelegate>
1414

1515
@property(nonatomic, strong) SASBannerView *bannerView;
1616

1717
@end
1818

19-
@implementation SASGADCustomEventBanner
19+
@implementation SASGMACustomEventBanner
2020

2121
@synthesize delegate;
2222

23-
#pragma mark GADCustomEventBanner implementation
23+
#pragma mark GMACustomEventBanner implementation
2424

2525
- (void)requestBannerAd:(GADAdSize)adSize
2626
parameter:(NSString *)serverParameter
2727
label:(NSString *)serverLabel
2828
request:(GADCustomEventRequest *)request {
2929

3030
// Create the bannerView with the appropriate size.
31-
self.bannerView =
32-
[[SASBannerView alloc] initWithFrame:CGRectMake(0, 0, adSize.size.width, adSize.size.height)];
31+
self.bannerView = [[SASBannerView alloc] initWithFrame:CGRectMake(0, 0, adSize.size.width, adSize.size.height)];
3332
self.bannerView.modalParentViewController = self.delegate.viewControllerForPresentingModalView;
3433
self.bannerView.delegate = self;
3534

@@ -55,11 +54,6 @@ - (BOOL)adView:(SASAdView *)adView shouldHandleURL:(NSURL *)URL {
5554
}
5655

5756

58-
- (void)adView:(SASAdView *)adView willPerformActionWithExit:(BOOL)willExit {
59-
[self.delegate customEventBannerWillLeaveApplication:self];
60-
}
61-
62-
6357
- (void)adViewWillPresentModalView:(SASAdView *)adView {
6458
[self.delegate customEventBannerWillPresentModal:self];
6559
}

SASGMACustomEventConstants.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//
2+
// SASGMACustomEventConstants.h
3+
//
4+
// Created by Julien Gomez on 27/06/16.
5+
// Copyright © 2016 Smart AdServer. All rights reserved.
6+
//
7+
8+
#define kSASBaseURLString @"https://mobile.smartadserver.com"
9+
#define kSASGMACustomEventServerSeparatorString @"/"
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// SASGADCustomEventInterstitial.h
2+
// SASGMACustomEventInterstitial.h
33
//
44
// Created by Julien Gomez on 22/06/16.
55
// Copyright © 2016 Smart AdServer. All rights reserved.
@@ -9,6 +9,6 @@
99
#import <GoogleMobileAds/GoogleMobileAds.h>
1010

1111

12-
@interface SASGADCustomEventInterstitial : NSObject<GADCustomEventInterstitial>
12+
@interface SASGMACustomEventInterstitial : NSObject<GADCustomEventInterstitial>
1313

1414
@end
Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
//
2-
// SASGADCustomEventInterstitial.m
2+
// SASGMACustomEventInterstitial.m
33
//
44
// Created by Julien Gomez on 22/06/16.
55
// Copyright © 2016 Smart AdServer. All rights reserved.
66
//
77

8-
#import "SASGADCustomEventInterstitial.h"
8+
#import "SASGMACustomEventInterstitial.h"
99
#import "SASInterstitialView.h"
10-
#import "SASAdView+GAD.h"
10+
#import "SASAdView+GMA.h"
1111

1212

13-
@interface SASGADCustomEventInterstitial () <SASAdViewDelegate>
13+
@interface SASGMACustomEventInterstitial () <SASAdViewDelegate>
1414

1515
@property(nonatomic, strong) SASInterstitialView *interstitialView;
1616

1717
@end
1818

19-
@implementation SASGADCustomEventInterstitial
19+
@implementation SASGMACustomEventInterstitial
2020

2121
@synthesize delegate;
2222

23-
#pragma mark GADCustomEventInterstitial implementation
23+
#pragma mark GMACustomEventInterstitial implementation
2424

2525
- (void)requestInterstitialAdWithParameter:(NSString *)serverParameter
2626
label:(NSString *)serverLabel
@@ -31,6 +31,7 @@ - (void)requestInterstitialAdWithParameter:(NSString *)serverParameter
3131
self.interstitialView =
3232
[[SASInterstitialView alloc] initWithFrame:rootViewController.view.bounds];
3333
self.interstitialView.delegate = self;
34+
3435
[self.interstitialView loadFormatWithDFPServerParameter:serverParameter request:request];
3536

3637
}
@@ -60,11 +61,6 @@ - (BOOL)adView:(SASAdView *)adView shouldHandleURL:(NSURL *)URL {
6061
}
6162

6263

63-
- (void)adView:(SASAdView *)adView willPerformActionWithExit:(BOOL)willExit {
64-
[self.delegate customEventInterstitialWillLeaveApplication:self];
65-
}
66-
67-
6864
- (void)adViewDidDisappear:(SASAdView *)adView {
6965
[self.delegate customEventInterstitialDidDismiss:self];
7066
}

0 commit comments

Comments
 (0)