SDK Reference
DEPRECATION NOTICE
On March 31, 2025, Taboola will sunset SDK 2.
Before then, please make sure to migrate to SDK 3 for iOS.
Feed and Widget via Native
SDK Reference | Required | Description |
---|---|---|
@property(nonatomic, strong) NSString *publisher | Mandatory | Sets the publisher ID |
@property(nonatomic, strong) NSString *mode | Mandatory | Sets the widget UI mode (template) |
@property(nonatomic, strong) NSString *placement | Mandatory | Sets the widget placement code (for reporting and configuration purposes) |
@property(nonatomic, strong) NSString *pageUrl | Mandatory | Sets the canonical URL for the page on which the widget is displayed |
@property(nonatomic, strong) NSString *pageId | Optional | Sets the page ID of the page on which the widget is displayed (default to auto generate from the URL) |
@property(nonatomic, weak) id | Optional | Attaches a TaboolaViewDelegate to the TaboolaView. Allows intercepting clicks. |
@property(nonatomic, weak) UIViewController *ownerViewController | Optional | Taboola in-app web-browser will be used to present selected content if this viewController is provided. If not provided, clicks will be opened in Safari. |
@property(nonatomic, readwrite) BOOL showBrowserIcons | Optional | Controls whether to show or hide the action buttons on the in-app browser. Default is "yes" |
@property (nonatomic, strong) UIColor *browserBackColor | Optional | Sets the background color for the in-app browser. Default is #f5f6f4 |
@property (nonatomic, strong) UIColor *browserTitleTextColor | Optional | Sets the color for the in-app browser title text. Default is #007cff |
@property(nonatomic, readwrite) BOOL autoResizeHeight | Optional | When enabled, TaboolaView automatically resizes its height after rendering the widget. Default is "yes". |
@property (nonatomic) NSString* mediation | Optional | Mediation provider. |
@property(nonatomic, readwrite) BOOL forceLegacyWebView | Optional | Default is "false". When set to "true", TaboolaView is forced to use UIWebView as the widget container instead of WKWebView, even when WKWebView is available (iOS 8 and above). Before using this feature, consult Taboola support or your Taboola account manager. |
@property(nonatomic, readwrite) NSString *optionalWidgetStyle | Optional | Forces CSS rules over the TaboolaWidget online HTML template. The method expects an in-line CSS rule string that is added to a element within the WKWebView containing the Widget/Feed |
@property(nonatomic, readwrite) NSString *unifiedId | Optional | An opaque, anonymized and unique identifier of the user in the publisher’s eco-system. This identifier should be identical across applications and devices (e.g. hashed e-mail, or login). |
Public Methods
SDK Reference | Required | Description |
---|---|---|
(void)setOptionalPageCommands:(NSDictionary *)pCommands; | Optional | Enables setting additional page commands to the Taboola widget, as used in the Taboola JavaScript API. @param pCommands list of commands |
(void)setOptionalModeCommands:(NSDictionary *)pCommands; | Optional | Enables setting additional mode commands to the Taboola widget, as used in the Taboola JavaScript API. @param pCommands list of commands. |
)setOptionalPageCommands:@{@"user_type":user_type_value}]; | Optional | Adding an option to pass an agreed enum that represents the publisher user type category (“subscriber”, “registered”, “guest”, “other”) |
)setOptionalPageCommands:@{@"hideScrollingBars":"false"}]; | Optional | Hiding the iOS webview scrolling bars from showing when using Feed. The default value is false |
- (void)setExtraProperties:(NSDictionary*) properties | Optional | This method is used to set specific key-value pairs to adjust the Taboola via Native behaviour. - "darkMode" - flags if the publisher is using dark mode theme. Please contact your account/solution manager before using this flag |
(void)fetchContent; | After initializing the TaboolaView, call this method to fetch the recommendations | |
(void)reset; | Resets the TaboolaView - All contents and pushed commands are cleared. New commands must be pushed before fetching data again. | |
(void)refresh; | Refreshes the recommendations displayed on the TaboolaView. |
Feed and Widget via JS
TaboolaJS
SDK Reference | Required | Description |
---|---|---|
+ (instancetype) sharedInstance | This returns a singleton instance of the SDK. | |
- (void)registerWebView:(UIView*) webView | This registers webView within the Taboola JS SDK. It unregisters an already registered webView from Taboola JS SDK. It is required to load or reload the page after unregistering the webview.Note: When the webView is no longer needed it must be unregistered using - (void)unregisterWebView:(UIView*) webView .IMPORTANT: webView must be either of class WKWebView or UIWebView . | |
- (void)unregisterWebView:(UIView*) webView | This unregisters an already registered webView from Taboola JS SDK. It is required to reload/load the page after unregistering the webview. | |
- (void)setExtraProperties:(NSDictionary*) properties | This method is used to set specific key-value pairs to adjust the TaboolaJS behaviour. "darkMode" - flags if the publisher is using dark mode theme. | |
@property LogLevel logLevel | This sets the log level for the SDK. LogLevel enum defines the importance levels. You can find LogLevel enum in the TaboolaLogger.h file, for example LogLevelError.This Gets the current log level used by the SDK. Default: LogLevelError . | |
- (NSSet*)registeredWebViews | This returns, NSSet* .The set of all currently registered webViews. | |
@property id | The TaboolaJSDelegate is used to intercept recommendation clicks, block default click handling for organic items and get notifications about render success or failure. |
TaboolaJSDelegate
SDK Reference | Required | Description |
---|---|---|
- (BOOL)onItemClick:(NSString | Optional | This method is called on every click on the Placement and returns a Boolean. Returning false aborts the default behavior, the app displays the recommendation content on its own (for example, using an in-app browser).IMPORTANT: This aborts only for organic items. Returning true enables the app to implement a click-through and continue to the default behavior. |
- (void)webView:(UIView | Optional | This method is called on every successful load of Placement. |
- (void)webView:(UIView | Optional | This method is called on every successful load of Placement. |
WebView Delegates – Default Return values
SDK Reference | Required | Description |
---|---|---|
- (BOOL)webView:(UIWebView | Optional | As TaboolaJS intervenes in the webview’s delegate logic, TaboolaJS implements a default for some of methods. Set webView delegate before registering the webView in TaboolaJS: UIWebView: webView.delegate = self. |
- (void)webView:(WKWebView | Optional | As TaboolaJS intervenes in the webview’s delegate logic, TaboolaJS implements a default for some of methods. Set webView delegate before registering the webView in TaboolaJS: WKWebView: webview.navigationDelegate = self. |
UIWebViewDelegate
SDK Reference | Required | Description |
---|---|---|
- (BOOL)webView:(UIWebView | Optional | Default return value: TRUE |
WKNavigationDelegate
SDK Reference | Required | Description |
---|---|---|
- (void)webView:(WKWebView | Optional | Default return value:decisionHandler(WKNavigationActionPolicyAllow); |
- (void)webView:(WKWebView | Optional | Default return value:decisionHandler(WKNavigationResponsePolicyAllow); |
- (void)webView:(WKWebView | Optional | Default return value:completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil); |
Updated 3 months ago