SDK Reference
DEPRECATION NOTICEOn March 31, 2025, Taboola will sunset SDK 2.
Before then, please make sure to migrate to SDK 4 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". |
| Optional | Forces CSS rules over the TaboolaWidget online HTML template. The method expects an in-line CSS rule string that is added to a |
| 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.
|
(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
| |
- (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 | |
- (NSSet*)registeredWebViews | This returns, | |
@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 )placementName withItemId:(NSString)itemId withClickUrl:(NSString *)clickUrl isOrganic:(BOOL)organic | Optional | This method is called on every click on the Placement and returns a Boolean.
|
- (void)webView:(UIView) webView didLoadPlacementNamed:(NSString) placementName withHeight:(CGFloat)height | Optional | This method is called on every successful load of Placement. |
- (void)webView:(UIView) webView didFailToLoadPlacementNamed:(NSString) placementName withErrorMessage:(NSString *) error | Optional | This method is called on every successful load of Placement. |
WebView Delegates β Default Return values
SDK Reference | Required | Description |
---|---|---|
- (BOOL)webView:(UIWebView )webView shouldStartLoadWithRequest:(NSURLRequest)request navigationType:(UIWebViewNavigationType)navigationType {
return YES; // users choice
} | 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 )webView decidePolicyForNavigationAction:(WKNavigationAction)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { | Optional | As TaboolaJS intervenes in the webviewβs delegate logic, TaboolaJS implements a default for some of methods. |
UIWebViewDelegate
SDK Reference | Required | Description |
---|---|---|
- (BOOL)webView:(UIWebView )webView shouldStartLoadWithRequest:(NSURLRequest)request navigationType:(UIWebViewNavigationType)navigationType | Optional | Default return value: |
WKNavigationDelegate
SDK Reference | Required | Description |
---|---|---|
- (void)webView:(WKWebView )webView decidePolicyForNavigationAction:(WKNavigationAction)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler | Optional | Default return value: |
- (void)webView:(WKWebView )webView decidePolicyForNavigationResponse:(WKNavigationResponse)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler | Optional | Default return value: |
- (void)webView:(WKWebView )webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler | Optional | Default return value: |
Updated about 5 hours ago