SDK DocumentationRecipesAnnouncementsSupport Forum
AndroidiOSAnnouncementsSupport Forum
SDK Documentation

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 ReferenceRequiredDescription
@property(nonatomic, strong) NSString *publisher MandatorySets the publisher ID
@property(nonatomic, strong) NSString *modeMandatorySets the widget UI mode (template)
@property(nonatomic, strong) NSString *placementMandatorySets the widget placement code (for reporting and configuration purposes)
@property(nonatomic, strong) NSString *pageUrl MandatorySets the canonical URL for the page on which the widget is displayed
@property(nonatomic, strong) NSString *pageIdOptionalSets the page ID of the page on which the widget is displayed (default to auto generate from the URL)
@property(nonatomic, weak) idOptionalAttaches a TaboolaViewDelegate to the TaboolaView. Allows intercepting clicks.
@property(nonatomic, weak) UIViewController *ownerViewControllerOptionalTaboola 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 showBrowserIconsOptionalControls whether to show or hide the action buttons on the in-app browser. Default is "yes"
@property (nonatomic, strong) UIColor *browserBackColorOptionalSets the background color for the in-app browser. Default is #f5f6f4
@property (nonatomic, strong) UIColor *browserTitleTextColorOptionalSets the color for the in-app browser title text. Default is #007cff
@property(nonatomic, readwrite) BOOL autoResizeHeightOptionalWhen enabled, TaboolaView automatically resizes its height after rendering the widget. Default is "yes".
@property (nonatomic) NSString* mediationOptionalMediation provider.
@property(nonatomic, readwrite) BOOL forceLegacyWebViewOptionalDefault 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 *optionalWidgetStyleOptionalForces 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 *unifiedIdOptionalAn 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 ReferenceRequiredDescription
(void)setOptionalPageCommands:(NSDictionary *)pCommands;OptionalEnables setting additional page commands to the Taboola widget, as used in the Taboola JavaScript API. @param pCommands list of commands
(void)setOptionalModeCommands:(NSDictionary *)pCommands;OptionalEnables 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}];OptionalAdding an option to pass an agreed enum that represents the publisher user type category (“subscriber”, “registered”, “guest”, “other”)
)setOptionalPageCommands:@{@"hideScrollingBars":"false"}];OptionalHiding the iOS webview scrolling bars from showing when using Feed. The default value is false
- (void)setExtraProperties:(NSDictionary*) propertiesOptionalThis 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 ReferenceRequiredDescription
+ (instancetype) sharedInstanceThis returns a singleton instance of the SDK.
- (void)registerWebView:(UIView*) webViewThis 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*) webViewThis unregisters an already registered webView from Taboola JS SDK. It is required to reload/load the page after unregistering the webview.
- (void)setExtraProperties:(NSDictionary*) propertiesThis 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 logLevelThis 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*)registeredWebViewsThis returns, NSSet*.The set of all currently registered webViews.
@property idThe TaboolaJSDelegate is used to intercept recommendation clicks, block default click handling for organic items and get notifications about render success or failure.

TaboolaJSDelegate

SDK ReferenceRequiredDescription
- (BOOL)onItemClick:(NSString OptionalThis 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:(UIViewOptionalThis method is called on every successful load of Placement.
- (void)webView:(UIViewOptionalThis method is called on every successful load of Placement.

WebView Delegates – Default Return values

SDK ReferenceRequiredDescription
- (BOOL)webView:(UIWebView OptionalAs 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 OptionalAs 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 ReferenceRequiredDescription
- (BOOL)webView:(UIWebView OptionalDefault return value: TRUE

WKNavigationDelegate

SDK ReferenceRequiredDescription
- (void)webView:(WKWebView OptionalDefault return value:
decisionHandler(WKNavigationActionPolicyAllow);
- (void)webView:(WKWebView OptionalDefault return value:
decisionHandler(WKNavigationResponsePolicyAllow);
- (void)webView:(WKWebView OptionalDefault return value:
completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil);