## Feed and Widget via Native
SDK Reference | Required | Description |
<code>@property(nonatomic, strong) NSString *publisher </code> | Mandatory | Sets the publisher ID |
<code>@property(nonatomic, strong) NSString *mode</code> | Mandatory | Sets the widget UI mode (template) |
<code>@property(nonatomic, strong) NSString *placement</code> | Mandatory | Sets the widget placement code (for reporting and configuration purposes) |
<code>@property(nonatomic, strong) NSString *pageUrl </code> | Mandatory | Sets the canonical URL for the page on which the widget is displayed |
<code>@property(nonatomic, strong) NSString *pageId</code> | Optional | Sets the page ID of the page on which the widget is displayed (default to auto generate from the URL) |
<code>@property(nonatomic, weak) id<TaboolaViewDelegate> delegate</code> | Optional | Attaches a TaboolaViewDelegate to the TaboolaView. Allows intercepting clicks. |
<code>@property(nonatomic, weak) UIViewController *ownerViewController</code> | 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. |
<code>@property(nonatomic, readwrite) BOOL showBrowserIcons</code> | Optional | Controls whether to show or hide the action buttons on the in-app browser. Default is "yes" |
<code>@property (nonatomic, strong) UIColor *browserBackColor</code> | Optional | Sets the background color for the in-app browser. Default is #f5f6f4 |
<code>@property (nonatomic, strong) UIColor *browserTitleTextColor</code> | Optional | Sets the color for the in-app browser title text. Default is #007cff |
<code>@property(nonatomic, readwrite) BOOL autoResizeHeight</code> | Optional | When enabled, TaboolaView automatically resizes its height after rendering the widget. Default is "yes". |
<code>@property (nonatomic) NSString* mediation</code> | Optional | Mediation provider. |
<code>@property(nonatomic, readwrite) BOOL forceLegacyWebView</code> | 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 <div> 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 |
<code>(void)setOptionalPageCommands:(NSDictionary *)pCommands;</code> | Optional | Enables setting additional page commands to the Taboola widget, as used in the Taboola JavaScript API. @param pCommands list of commands |
<code>(void)setOptionalModeCommands:(NSDictionary *)pCommands;</code> | Optional | Enables setting additional mode commands to the Taboola widget, as used in the Taboola JavaScript API. @param pCommands list of commands. |
<code>)setOptionalPageCommands:@{@"user_type":user_type_value}];</code> | Optional | Adding an option to pass an agreed enum that represents the publisher user type category (βsubscriberβ, βregisteredβ, βguestβ, βotherβ) |
<code>)setOptionalPageCommands:@{@"hideScrollingBars":"false"}];</code> | Optional | Hiding the iOS webview scrolling bars from showing when using Feed. The default value is false |
<code>- (void)setExtraProperties:(NSDictionary*) properties</code> | 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 |
<code>(void)fetchContent;</code> | ο»Ώ | After initializing the TaboolaView, call this method to fetch the recommendations |
<code>(void)reset;</code> | ο»Ώ | Resets the TaboolaView - All contents and pushed commands are cleared. New commands must be pushed before fetching data again. |
<code>(void)refresh;</code> | ο»Ώ | Refreshes the recommendations displayed on the TaboolaView. |
## Feed and Widget via JS
**TaboolaJS**
SDK Reference | Required | Description |
<code>+ (instancetype) sharedInstance</code> | ο»Ώ | This returns a singleton instance of the SDK. |
<code>- (void)registerWebView:(UIView*) webView</code> | ο»Ώ | 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 `. |
<code>- (void)unregisterWebView:(UIView*) webView</code> | ο»Ώ | This unregisters an already registered webView from Taboola JS SDK. It is required to reload/load the page after unregistering the webview. |
<code>- (void)setExtraProperties:(NSDictionary*) properties</code> | ο»Ώ | 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. |
<code>@property LogLevel logLevel</code> | ο»Ώ | 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 `. |
<code>- (NSSet*)registeredWebViews</code> | ο»Ώ | This returns, `NSSet* `.The set of all currently registered webViews. |
<code>@property id<TaboolaJSDelegate> delegate</code> | ο»Ώ | 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 |
<code>- (BOOL)onItemClick:(NSString _)placementName withItemId:(NSString _)itemId withClickUrl:(NSString *)clickUrl isOrganic:(BOOL)organic</code> | 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. |
<code>- (void)webView:(UIView_) webView didLoadPlacementNamed:(NSString _) placementName withHeight:(CGFloat)height</code> | Optional | This method is called on every successful load of Placement. |
<code>- (void)webView:(UIView_) webView didFailToLoadPlacementNamed:(NSString _) placementName withErrorMessage:(NSString *) error</code> | Optional | This method is called on every successful load of Placement. |
**WebView Delegates β Default Return values**
SDK Reference | Required | Description |
<code>- (BOOL)webView:(UIWebView _)webView shouldStartLoadWithRequest:(NSURLRequest _)request navigationType:(UIWebViewNavigationType)navigationType { return YES; // users choice }</code> | 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. |
<code>- (void)webView:(WKWebView _)webView decidePolicyForNavigationAction:(WKNavigationAction _)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { decisionHandler(WKNavigationActionPolicyAllow); // users choice }</code> | 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 |
<code>- (BOOL)webView:(UIWebView _)webView shouldStartLoadWithRequest:(NSURLRequest _)request navigationType:(UIWebViewNavigationType)navigationType</code> | Optional | Default return value: `TRUE ` |
**WKNavigationDelegate**
SDK Reference | Required | Description |
<code>- (void)webView:(WKWebView _)webView decidePolicyForNavigationAction:(WKNavigationAction _)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler</code> | Optional | Default return value:
`decisionHandler(WKNavigationActionPolicyAllow); ` |
<code>- (void)webView:(WKWebView _)webView decidePolicyForNavigationResponse:(WKNavigationResponse _)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler</code> | Optional | Default return value:
`decisionHandler(WKNavigationResponsePolicyAllow); ` |
<code>- (void)webView:(WKWebView _)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge _)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler</code> | Optional | Default return value:
`completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil); ` |