SDK Ads iOS

From wiki.taptica.com
(Difference between revisions)
Jump to: navigation, search
(Implementing TapticaAd™ iOS SDK)
(TapticaAdManager Optional Methods)
 
(14 intermediate revisions by one user not shown)
Line 16: Line 16:
 
Following download, you can extract the downloaded file which contains the following items:
 
Following download, you can extract the downloaded file which contains the following items:
  
1)Static Library: libTapticaAd.a
+
1.Static Library: libTapticaAd.a
  
2)Header file: TapticaAd.h
+
2.Header file: TapticaAd.h
  
3)Sample project
+
3.Sample project
  
 
==Implementing TapticaAd™ iOS SDK==
 
==Implementing TapticaAd™ iOS SDK==
Line 33: Line 33:
  
  
<nowiki>#import "TapticaAd.h"
+
    #import "TapticaAd.h"
 
+
        TapticaAdManager *TapticaAdManager;
    TapticaAdManager *TapticaAdManager;</nowiki>
+
 
+
  
 
For example:
 
For example:
  
<nowiki>#import <UIKit/UIKit.h>
+
    #import <UIKit/UIKit.h>
#import "TapticaAd.h"
+
    #import "TapticaAd.h"
@class TapticaAdTestViewController;
+
    @class TapticaAdTestViewController;
@interface TapticaAdTestAppDelegate : NSObject <UIApplicationDelegate> {
+
    @interface TapticaAdTestAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
+
      UIWindow *window;
TapticaAdTestViewController *viewController;
+
      TapticaAdTestViewController *viewController;
TapticaAdManager *TapticaAdManager;
+
      TapticaAdManager *TapticaAdManager;
}
+
    }
@property (nonatomic, retain) TapticaAdManager *TapticaAdManager;
+
    @property (nonatomic, retain) TapticaAdManager *TapticaAdManager;
@property (nonatomic, retain) IBOutlet UIWindow *window;
+
    @property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet TapticaAdTestViewController *viewController;
+
    @property (nonatomic, retain) IBOutlet TapticaAdTestViewController *viewController;
@end</nowiki>
+
    @end
  
 
4. Inside “"applicationDidFinishLaunching:" in your delegate m file add:
 
4. Inside “"applicationDidFinishLaunching:" in your delegate m file add:
 +
 
TapticaAdManager = [TapticaAdManager instance];
 
TapticaAdManager = [TapticaAdManager instance];
 +
 
[TapticaAdManager setTapticaAdApplicationID:@"YOUR_APPLICATION_ID"];
 
[TapticaAdManager setTapticaAdApplicationID:@"YOUR_APPLICATION_ID"];
 +
  
 
For example:
 
For example:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
+
    // Override point for customization after application launch.
TapticaAdManager = [TapticaAdManager instance];
+
    TapticaAdManager = [TapticaAdManager instance];
[TapticaAdManager setTapticaAdApplicationID:@"YOUR_APPLICATION_ID"];
+
    [TapticaAdManager setTapticaAdApplicationID:@"YOUR_APPLICATION_ID"];
// Add the view controller's view to the window and display.
+
    // Add the view controller's view to the window and display.
[self.window addSubview:viewController.view];
+
    [self.window addSubview:viewController.view];
[self.window makeKeyAndVisible];
+
    [self.window makeKeyAndVisible];
return YES;
+
    return YES;
}
+
    }
 +
 
 +
 
 +
 
 +
== Calling the TapticaAd™ iOS SDK  ==
 +
To call the TapticaAd™ iOS SDK:
 +
 
 +
1.In your view controller header add:
 +
    #import "TapticaAd.h"
 +
    TapticaAdView *TapticaAdView;
 +
 
 +
 
 +
2.In your view controller m file inside viewDidLoad add:
 +
    TapticaAdView = [[TapticaAdView alloc] init];
 +
    CGRect frame = [[TapticaAdView view] frame];
 +
    frame.origin.y = 412.0;//the frame.origin.y can be customized.
 +
    [[TapticaAdView view] setFrame:frame];
 +
    [self.view addSubview:[TapticaAdView view]];
 +
    [TapticaAdView requestAdd];
 +
 
 +
 
 +
 
 +
'''For banner ad use:'''
 +
    [TapticaAdView requestAd];
 +
 
 +
'''For full screen ad use:'''
 +
    [TapticaAdView requestFullScreenAd];
 +
 
 +
When requesting banner ad, it will appear & refreshed until removed from super view.
 +
It is possible to request full screen ad while banner ad are displaying.
 +
When requesting full screen while banner ad displaying the banner ad will be paused and not refreshed.
 +
 
 +
 
 +
 
 +
== Common Classes ==
 +
The API in the SDK is composed of 2 basic classes:
 +
 
 +
1.'''TapticaAdView'''– an ad view that simply shows an ad. This view only shows an ad after you have requested an ad. It is implemented using requestAd or requestFullScreenAd
 +
 
 +
2.'''TapticaAdManager'''– a module class that manages all TapticaAdView class instances and the extra data that can be transferred to the server for each ad request.
 +
 
 +
 
 +
== TapticaAdManager Mandatory Methods ==
 +
 
 +
'''- (BOOL)setTapticaAdApplicationID:(NSString*)appID;'''
 +
 
 +
Sets the application ID (appID) as generated in the TapticaDevelopment Site.
 +
 
 +
== TapticaAdManager Optional Methods ==
 +
'''- (BOOL)setTapticaAdIncome:(int)income;'''
 +
 
 +
Sets the user estimated income.
 +
 
 +
'''- (BOOL)setTapticaAdKeywords:(NSString *)keywords;'''
 +
 
 +
Sets the keywords to be sent to the server for each ad request. For example,with an application for toddlers, you might consider using “kids children toys” as keywords.
 +
 
 +
'''- (BOOL)setTapticaAdUserPostalCode:(int)postalCode;'''
 +
 
 +
Sets the user zip code.
 +
 
 +
'''- (BOOL)setTapticaAdUserAreaCode:(int)areaCode;'''
 +
 
 +
Sets the user area code.
 +
 
 +
'''- (BOOL)setTapticaAdUserBirthdate:(NSString *)date;'''
 +
 
 +
Sets the user birthday with format yyyymmdd.
 +
 
 +
'''- (BOOL)setTapticaAdMartialStatus:(int)status;'''
 +
 
 +
Sets the user marital status as follow:
 +
 
 +
0 = unknown, 1 = single, 2 = divorced, 3 = engaged, 4 = relationship, 5 = swinger
 +
 
 +
'''- (BOOL)setTapticaAdUserGender:(int)gender;'''
 +
 
 +
Sets the user gender as follows:
 +
 
 +
0 = unknown, 1 = male, 2 = female
 +
 
 +
'''- (BOOL)setTapticaAdEducation:(int)education;'''
 +
 
 +
Sets the user education as follows:
 +
 
 +
0 = unknown, 1 = UG, 2 = PG
 +
 
 +
'''- (BOOL)setTapticaAdInterests:(NSString *)interests;'''
 +
 
 +
Sets user interests.
 +
 
 +
'''- (BOOL)setTapticaAdEthnicity:(NSString *)ethnicity;'''
 +
 
 +
Sets the users ethnicity.
 +
 
 +
'''- (BOOL)setTapticaAdTestMode:(BOOL)testMode;'''
 +
 
 +
Can set the next ad requests to be test ads. Such ads will always be returned, but are not real ads and therefore will not provide any profit when clicked. This feature is intended for use during the development process and not for when the application is on the market.
 +
 
 +
'''-(BOOL)setTapticaAdGeoLocation:(double)latitudelongitude:(double)longitude;'''
 +
 
 +
Sets the geographic location of the device to be the location specified. This can
 +
be a useful feature in the following scenarios:
 +
1. Debugging - when you want to check that the ads will be delivered based on the location of the device.
 +
2. Knowledge of the target audience – when you want to provide ads limited to a specific area.
 +
 
 +
 
 +
 
 +
----
 +
'''Note:'''
 +
We recommend adding as much data as possible to the server about the target audience. This will enable the most appropriate ads to be formulated according to the provided data.
 +
----
 +
 
 +
 
 +
For Example
 +
 
 +
    MyAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
 +
    [delegate.TapticaAdManager setTapticaAdUserGender:1];
 +
    [delegate.TapticaAdManager setTapticaAdUserBirthdate:@"19750613"];
 +
    [delegate.TapticaAdManager setTapticaAdUserAreaCode:972];
 +
    [delegate.TapticaAdManager setTapticaAdMartialStatus:1];
 +
    [delegate.TapticaAdManager setTapticaAdKeywords:@"kids children toys"];
 +
    [delegate.TapticaAdManager setTapticaAdInterests:@"circus contortionist"];
 +
    [delegate.TapticaAdManager setTapticaAdIncome:15000];
 +
    [delegate.TapticaAdManager setTapticaAdEthnicity:@"Afro-Portuguese"];
 +
    [delegate.TapticaAdManager setTapticaAdEducation:1];
 +
    [delegate.TapticaAdManager setTapticaAdGeoLocation:10.0 longitude:30.2];
 +
    TapticaAdView = [[TapticaAdView alloc] init];
 +
    CGRect frame = [[TapticaAdView view] frame];
 +
    frame.origin.y = 412.0; //the frame.origin.y can be customized
 +
    [[TapticaAdView view] setFrame:frame];
 +
    [self.view addSubview:[TapticaAdView view]];
 +
    [TapticaAdView requestAdd];

Latest revision as of 15:56, 21 August 2012

Contents

[edit] Steps to Integration

To integrate with TapticaAd™ SDK, follow these steps: 1. Application/Site Id – Retrieve your app/site Id from Taptica’s account manager. 2. Download TapticaAd™ iOS SDK – download the iOS SDK from the Tapticadeveloper’s website. 3. Implement TapticaAd™ iOS SDK – implement the iOS SDK in your app so that it can be used. 4. Call TapticaAd™ iOS SDK – perform ad requests.


[edit] Application/Site ID Taptica Ad

Retrieve your Application Id from Taptica’s account manager or register to the TapticaAd™ service via Taptica’s website – http://taptica.com. At the end of the process you will acquire an Application ID. Save it for future use, it will be needed when identifying your application/site while using the TapticaAd™ iOS SDK.


[edit] Downloading TapticaAd™ iOS SDK

Following download, you can extract the downloaded file which contains the following items:

1.Static Library: libTapticaAd.a

2.Header file: TapticaAd.h

3.Sample project

[edit] Implementing TapticaAd™ iOS SDK

To implement the TapticaAd™ iOS SDK:

1. Use the system Finder to drag the unzipped SDK folder into your project.

2. Drag and drop the folder to your project xcode group tree.

3. Update your application delegate header file with:


    #import "TapticaAd.h"
        TapticaAdManager *TapticaAdManager;

For example:

    #import <UIKit/UIKit.h>
    #import "TapticaAd.h"
    @class TapticaAdTestViewController;
    @interface TapticaAdTestAppDelegate : NSObject <UIApplicationDelegate> {
      UIWindow *window;
      TapticaAdTestViewController *viewController;
      TapticaAdManager *TapticaAdManager;
    }
    @property (nonatomic, retain) TapticaAdManager *TapticaAdManager;
    @property (nonatomic, retain) IBOutlet UIWindow *window;
    @property (nonatomic, retain) IBOutlet TapticaAdTestViewController *viewController;
    @end

4. Inside “"applicationDidFinishLaunching:" in your delegate m file add:

TapticaAdManager = [TapticaAdManager instance];

[TapticaAdManager setTapticaAdApplicationID:@"YOUR_APPLICATION_ID"];


For example:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    TapticaAdManager = [TapticaAdManager instance];
    [TapticaAdManager setTapticaAdApplicationID:@"YOUR_APPLICATION_ID"];
    // Add the view controller's view to the window and display.
    [self.window addSubview:viewController.view];
    [self.window makeKeyAndVisible];
    return YES;
    }


[edit] Calling the TapticaAd™ iOS SDK

To call the TapticaAd™ iOS SDK:

1.In your view controller header add:

    #import "TapticaAd.h"
    TapticaAdView *TapticaAdView;


2.In your view controller m file inside viewDidLoad add:

    TapticaAdView = [[TapticaAdView alloc] init];
    CGRect frame = [[TapticaAdView view] frame];
    frame.origin.y = 412.0;//the frame.origin.y can be customized.
    [[TapticaAdView view] setFrame:frame];
    [self.view addSubview:[TapticaAdView view]];
    [TapticaAdView requestAdd];


For banner ad use:

    [TapticaAdView requestAd];

For full screen ad use:

    [TapticaAdView requestFullScreenAd];

When requesting banner ad, it will appear & refreshed until removed from super view. It is possible to request full screen ad while banner ad are displaying. When requesting full screen while banner ad displaying the banner ad will be paused and not refreshed.


[edit] Common Classes

The API in the SDK is composed of 2 basic classes:

1.TapticaAdView– an ad view that simply shows an ad. This view only shows an ad after you have requested an ad. It is implemented using requestAd or requestFullScreenAd

2.TapticaAdManager– a module class that manages all TapticaAdView class instances and the extra data that can be transferred to the server for each ad request.


[edit] TapticaAdManager Mandatory Methods

- (BOOL)setTapticaAdApplicationID:(NSString*)appID;

Sets the application ID (appID) as generated in the TapticaDevelopment Site.

[edit] TapticaAdManager Optional Methods

- (BOOL)setTapticaAdIncome:(int)income;

Sets the user estimated income.

- (BOOL)setTapticaAdKeywords:(NSString *)keywords;

Sets the keywords to be sent to the server for each ad request. For example,with an application for toddlers, you might consider using “kids children toys” as keywords.

- (BOOL)setTapticaAdUserPostalCode:(int)postalCode;

Sets the user zip code.

- (BOOL)setTapticaAdUserAreaCode:(int)areaCode;

Sets the user area code.

- (BOOL)setTapticaAdUserBirthdate:(NSString *)date;

Sets the user birthday with format yyyymmdd.

- (BOOL)setTapticaAdMartialStatus:(int)status;

Sets the user marital status as follow:

0 = unknown, 1 = single, 2 = divorced, 3 = engaged, 4 = relationship, 5 = swinger

- (BOOL)setTapticaAdUserGender:(int)gender;

Sets the user gender as follows:

0 = unknown, 1 = male, 2 = female

- (BOOL)setTapticaAdEducation:(int)education;

Sets the user education as follows:

0 = unknown, 1 = UG, 2 = PG

- (BOOL)setTapticaAdInterests:(NSString *)interests;

Sets user interests.

- (BOOL)setTapticaAdEthnicity:(NSString *)ethnicity;

Sets the users ethnicity.

- (BOOL)setTapticaAdTestMode:(BOOL)testMode;

Can set the next ad requests to be test ads. Such ads will always be returned, but are not real ads and therefore will not provide any profit when clicked. This feature is intended for use during the development process and not for when the application is on the market.

-(BOOL)setTapticaAdGeoLocation:(double)latitudelongitude:(double)longitude;

Sets the geographic location of the device to be the location specified. This can be a useful feature in the following scenarios: 1. Debugging - when you want to check that the ads will be delivered based on the location of the device. 2. Knowledge of the target audience – when you want to provide ads limited to a specific area.



Note: We recommend adding as much data as possible to the server about the target audience. This will enable the most appropriate ads to be formulated according to the provided data.



For Example

    MyAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
    [delegate.TapticaAdManager setTapticaAdUserGender:1];
    [delegate.TapticaAdManager setTapticaAdUserBirthdate:@"19750613"];
    [delegate.TapticaAdManager setTapticaAdUserAreaCode:972];
    [delegate.TapticaAdManager setTapticaAdMartialStatus:1];
    [delegate.TapticaAdManager setTapticaAdKeywords:@"kids children toys"];
    [delegate.TapticaAdManager setTapticaAdInterests:@"circus contortionist"];
    [delegate.TapticaAdManager setTapticaAdIncome:15000];
    [delegate.TapticaAdManager setTapticaAdEthnicity:@"Afro-Portuguese"];
    [delegate.TapticaAdManager setTapticaAdEducation:1];
    [delegate.TapticaAdManager setTapticaAdGeoLocation:10.0 longitude:30.2];
    TapticaAdView = [[TapticaAdView alloc] init];
    CGRect frame = [[TapticaAdView view] frame];
    frame.origin.y = 412.0; //the frame.origin.y can be customized
    [[TapticaAdView view] setFrame:frame];
    [self.view addSubview:[TapticaAdView view]];
    [TapticaAdView requestAdd];
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox