SDK DocumentationRecipesAnnouncementsSupport Forum
AndroidiOSAnnouncementsSupport Forum


## Feed and Widget via Native

SDK ReferenceRequiredDescription
<code>@property(nonatomic, strong) NSString *publisher </code>MandatorySets the publisher ID
<code>@property(nonatomic, strong) NSString *mode</code>MandatorySets the widget UI mode (template)
<code>@property(nonatomic, strong) NSString *placement</code>MandatorySets the widget placement code (for reporting and configuration purposes)
<code>@property(nonatomic, strong) NSString *pageUrl </code>MandatorySets the canonical URL for the page on which the widget is displayed
<code>@property(nonatomic, strong) NSString *pageId</code>OptionalSets 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>OptionalAttaches a TaboolaViewDelegate to the TaboolaView. Allows intercepting clicks.
<code>@property(nonatomic, weak) UIViewController *ownerViewController</code>OptionalTaboola 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>OptionalControls whether to show or hide the action buttons on the in-app browser. Default is "yes"
<code>@property (nonatomic, strong) UIColor *browserBackColor</code>OptionalSets the background color for the in-app browser. Default is #f5f6f4
<code>@property (nonatomic, strong) UIColor *browserTitleTextColor</code>OptionalSets the color for the in-app browser title text. Default is #007cff
<code>@property(nonatomic, readwrite) BOOL autoResizeHeight</code>OptionalWhen enabled, TaboolaView automatically resizes its height after rendering the widget. Default is "yes".
<code>@property (nonatomic) NSString* mediation</code>OptionalMediation provider.
<code>@property(nonatomic, readwrite) BOOL forceLegacyWebView</code>OptionalDefault 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`OptionalForces 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`OptionalAn 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
<code>(void)setOptionalPageCommands:(NSDictionary *)pCommands;</code>OptionalEnables 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>OptionalEnables 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>OptionalAdding an option to pass an agreed enum that represents the publisher user type category (โ€œsubscriberโ€, โ€œregisteredโ€, โ€œguestโ€, โ€œotherโ€)
<code>)setOptionalPageCommands:@{@"hideScrollingBars":"false"}];</code>OptionalHiding the iOS webview scrolling bars from showing when using Feed. The default value is false
<code>- (void)setExtraProperties:(NSDictionary*) properties</code>OptionalThis 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 ReferenceRequiredDescription
<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 ReferenceRequiredDescription
<code>- (BOOL)onItemClick:(NSString _)placementName withItemId:(NSString _)itemId withClickUrl:(NSString *)clickUrl isOrganic:(BOOL)organic</code>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.
<code>- (void)webView:(UIView_) webView didLoadPlacementNamed:(NSString _) placementName withHeight:(CGFloat)height</code>OptionalThis method is called on every successful load of Placement.
<code>- (void)webView:(UIView_) webView didFailToLoadPlacementNamed:(NSString _) placementName withErrorMessage:(NSString *) error</code>OptionalThis method is called on every successful load of Placement.

**WebView Delegates โ€“ Default Return values**

SDK ReferenceRequiredDescription
<code>- (BOOL)webView:(UIWebView _)webView shouldStartLoadWithRequest:(NSURLRequest _)request navigationType:(UIWebViewNavigationType)navigationType { return YES; // users choice }</code>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.
<code>- (void)webView:(WKWebView _)webView decidePolicyForNavigationAction:(WKNavigationAction _)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { decisionHandler(WKNavigationActionPolicyAllow); // users choice }</code>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
<code>- (BOOL)webView:(UIWebView _)webView shouldStartLoadWithRequest:(NSURLRequest _)request navigationType:(UIWebViewNavigationType)navigationType</code>OptionalDefault return value: `TRUE`

**WKNavigationDelegate**

SDK ReferenceRequiredDescription
<code>- (void)webView:(WKWebView _)webView decidePolicyForNavigationAction:(WKNavigationAction _)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler</code>OptionalDefault return value: `decisionHandler(WKNavigationActionPolicyAllow);`
<code>- (void)webView:(WKWebView _)webView decidePolicyForNavigationResponse:(WKNavigationResponse _)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler</code>OptionalDefault return value: `decisionHandler(WKNavigationResponsePolicyAllow);`
<code>- (void)webView:(WKWebView _)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge _)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler</code>OptionalDefault return value: `completionHandler(NSURLSessionAuthChallengeRejectProtectionSpace, nil);`