---
updatedAt: 2025-09-28T14:10:59.000Z
agentTools:
  projectIndex: https://developers.taboola.com/taboolasdk/llms.txt
---

# Event Handling

*iOS Classic* - Event Handling

### Overview

When fetching and displaying **Taboola** content, you may need to handle certain events. *Taboola Classic Integration* provides a **`TBLClassicPageDelegate`** for event handling.

The following events are supported.

### didClickPlacementName

An item in the placement was clicked.

> 👍 Use Case
>
> Use this method to intercept the **click** event, and open **organic** content directly within your app.

```objectivec
- (BOOL)classicUnit:(UIView*)classicUnit didClickPlacementName:(NSString *)placementName itemId:(NSString *)itemId clickUrl:(NSString *)clickUrl isOrganic:(BOOL)organic customData:(NSDictionary *)customData{
    // Insert your code here...
    // Return 'NO' to handle the click event yourself - or 'YES' for Taboola to handle it.
    // Note: you can override the default behavior for *organic* content only.
    return YES;
}
```
```swift
func classicUnit(_ classicUnit: UIView!, didClickPlacementName placementName: String!, itemId: String!, clickUrl: String!, isOrganic organic: Bool, customData: [AnyHashable : Any]!) -> Bool {
    // Insert your code here...
    // Return 'false' if you are handling the click event yourself, or 'true' if you want Taboola SDK to handle the click event.
    // Note: you can override the default behavior for *organic* content only.
    return true;
}
```

> 📘 Callback params
>
> * `classicUnit` - A reference to the placement, returned as type `UIView`.
> * `placementName` - The name of the clicked placement  - e.g. `"Feed without video"`.
> * `itemId` - The *ID* of the clicked item.
> * `clickUrl` - The *Click URL* of the clicked item.
> * `organic` - A boolean value, indicating if the clicked item is *organic*. (If not, then you *cannot* override the click behavior.)

> 📘 Return value
>
> * Return `true` (or `YES` for *Obj C*) to indicate that **Taboola SDK** should open the *Click URL*.
> * Return `false`  (or `NO` for *Obj C*) to prevent **Taboola SDK** from opening the *Click URL* (allowing you to handle it).

> 🚧
>
> You can override the default behavior for *organic* content *only*.

### didLoadOrResizePlacementName

Returns the loaded placement with its updated height.

> 🚧 Best practice
>
> Let [Taboola SDK manage the cell](https://developers.taboola.com/taboolasdk/docs/ios-sdk-classic-basic-integration#manage-the-layout), so that *no* event handling is required here
>
> Otherwise - insert your resizing code (for both the `<<` *and* `<<`) here.

```objectivec
- (void)classicUnit:(UIView *)classicUnit didLoadOrResizePlacementName:(NSString *)placementName height:(CGFloat)height placementType:(PlacementType)placementType {
    NSLog(@"%@", placementName);
    // If Taboola manages the UI (*recommended*), then NO special handling is required here.
    // Else - insert your code here.
}
```
```swift
func classicUnit(_ classicUnit: UIView!, didLoadOrResizePlacementName placementName: String!, height: CGFloat, placementType: PlacementType) {
    print("Placement name: \(String(describing: placementName)) has been loaded with height: \(height)")
    // If Taboola manages the UI (*recommended*), then NO special handling is required here.
    // Else - insert your code here.
}
```

> 📘 Params
>
> * `placementName` - The name of the placement loaded/resized.
> * `height` - The height, in pixels, of the placement loaded/resized.
> * `placementType` - `<<` or `<<`.

> 🚧
>
> For a more detailed example, see: [Advanced Options > Publisher manages the cell](https://developers.taboola.com/taboolasdk/docs/ios-sdk-classic-advanced-options#publisher-manages-the-cell).

### adDidReceiveSuccess

Triggered when an ad loads successfully.

```objectivec
- (void)adDidReceiveSuccess:(UIView *)classicUnit {
    // Insert your code here...
}
```
```swift
func adDidReceiveSuccess(_ classicUnit: UIView!) {
    // Insert your code here...
}
```

### didFailToLoadPlacementName

The Taboola **Unit** *failed* to receive an ad.

```objectivec
- (void)classicUnit:(UIView *)classicUnit didFailToLoadPlacementName:(NSString *)placementName errorMessage:(NSString *)error {
    NSLog(@"%@", error);
    // Insert your code here...
}
```
```swift
func classicUnit(_ classicUnit: UIView!, didFailToLoadPlacementName placementName: String!, errorMessage error: String!) {
    print(error as Any)
    // Insert your code here...
}
```

> 📘 Params
>
> * `placementName` - The name of the placement that failed.
> * `error` - The error message. (See below for possible values.)

**Possible values for `error`:**

| Value            | Description                        |
| :--------------- | :--------------------------------- |
| `NO_ITEMS`       | No Taboola content was returned.   |
| `WRONG_PARAMS`   | The wrong `tb_mode` was submitted. |
| `RESPONSE_ERROR` |                                    |
| `TIMEOUT`        | A connectivity issue occurred.     |
| `UNKNOWN_ERROR`  | An unknown error occurred.         |
| `INTERNAL_1`     | An internal server error occurred. |

### updateContentDidComplete

Triggered when a **Taboola** `<<` has finished **updating** its content.

> 👍 Use case
>
> When your app detects a *Pull-To-Refresh* gesture, invoke `fetchContent()` on your `TBLClassicUnit` instance to refresh content.
>
> (*For example*, in a *Taboola News* integration, where Taboola **Feed** covers the entire screen.)
>
> The `updateContentDidComplete` event will trigger once the requested content has updated.
>
> ***
>
> **Note**: The `updateContentDidComplete` event is **not** called when the content is **first** loaded.

```objectivec
- (void)updateContentDidComplete:(UIView *)classicUnit {
    // Insert your code here...  
}
```
```swift
func updateContentDidComplete(_ classicUnit: UIView!) {
    // Insert your code here...
}
```

> 🚧
>
> Applies to **`<<`** *only*.

### onEvent

When *refreshing* content for a given Taboola **Unit** (see the **Use Case** above), use `onEvent` to detect if a failure occurred:

```objectivec
- (void)classicUnit:(UIView *)classicUnit onEvent:(ReportActionType)actionType data:(NSDictionary *)data {
    // Insert your code here...
}
```
```swift
func classicUnit(_ classicUnit: UIView, onEvent actionType: ReportActionType, data: [AnyHashable: Any]) {
    // Insert your code here...
}
```

> 📘 Params
>
> * `actionType` - a **numeric enum** with the following possible values:
>   1. `ErrorUnknown` (`= 1`) - An unknown error occurred.
>   2. `UpdateFailed` (`= 2`) - The Taboola **Unit** *failed* to receive an ad, while re-fetching content.

### scrollViewDidScrollToTopClassicUnit

When the user scrolls down in your app and encounters a Taboola `<<`, the SDK automatically switches the scroll from your app to the Feed (i.e. to the Feed's web view). This scroll switch is handled *automatically* by **Taboola SDK**, without any action on your part.

***

> 💁🏻 Need a hand?
>
> Go ahead! Ask a question in our [Support Forum](https://sdk.taboola.com/taboolasdk/discuss).
>
> **Tip**: Provide as much detail as possible, including your platform and SDK version.