Advanced Usage

Specify a custom campaign tag

By default if no campaign tag was specified SDK uses ios-invite and ios-post-purchase tags for Standalone and Post Purchase campaigns. But you can explicitly specify your own tag in this way:

#import <TalkableSDK/Talkable.h>
...
[[Talkable manager] registerOrigin:TKBLAffiliateMember params:@{TKBLCampaignTags: @"your-custom-tag"}];
...

Implement TalkableDelegate

  1. Assign your ViewController or other object as Talkable delegate by following code:
[[Talkable manager] setDelegate: yourObjectConformsTalkableDelegateProtocol];
  1. Take control of presenting offers to your users. Use next two delegate methods to prevent or give an instruction where you want that offer will be displayed:
- (BOOL)shouldPresentTalkableOfferViewController:(UIViewController*)controller;
- (UIViewController*)viewControllerForPresentingTalkableOfferViewController;
  1. Customize ViewContoller title by implementing method below. By default title of offer page is used.
- (NSString*)titleForTalkableOfferViewController:(UIViewController*)controller;

Note

You can modify page title on Talkable Site during campaign developing.

  1. Present offers to your users by yourself by handling request url or webView after origin was created.
- (void)didRegisterOrigin:(TKBLOriginType)type withURL:(NSURL*)url;
- (void)didRegisterOrigin:(TKBLOriginType)type withWebView:(WKWebView*)webView;

Note

Talkable SDK assigns itself to WKWebView navigation delegate. Changing WKWebView navigation delegate may brokes some functionality so we strictly not recommend to do this.

Notifications

Subscribe to notifications that Talkable SDK publish and be aware of everything that happens around your campaigns.

  1. Receive the coupon given to your users:
#import <TalkableSDK/Talkable.h>
...
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(couponReceived:) name:TKBLDidReceiveCouponCode object:nil];
...
- (void)couponReceived:(NSNotification*)ntf {
  // Your logic here
}
...
  1. Catch every message from presented offer:
#import <TalkableSDK/Talkable.h>
...
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(publishMessageNotification:) name:TKBLDidPublishMessageNotification object:nil];
...
- (void)publishMessageNotification:(NSNotification*)ntf {
  if ([[[ntf userInfo] objectForKey:TKBLMessageNameKey] isEqualToString:TKBLMessageOfferLoaded]) {
    // Your logic here
  }
}
...

Available messages:

  • TKBLMessageOfferLoaded
  • TKBLMessageOfferClose
  • TKBLMessageCouponIssued

Debuging

See all debugging information in your console which can help you to realise what is going wrong:

#import <TalkableSDK/Talkable.h>
...
[Talkable manager].debug = YES;