# Interactions and Banners

> Report when a recommendation widget is shown, seen and clicked, and track banners.

Segmentify measures a campaign by its interactions. Without them, widgets show up in your app but their reports stay empty.

## Widget interactions

```swift
let manager = SegmentifyManager.sharedManager()

// the widget was returned and placed on the screen
manager.sendImpression(instanceId: instanceId, interactionId: interactionId)

// the widget became visible to the user
manager.sendWidgetView(instanceId: instanceId, interactionId: interactionId)

// the user tapped a product of the widget
manager.sendClickView(instanceId: instanceId, interactionId: productId)
```

| Method | When | `interactionId` |
| --- | --- | --- |
| `sendImpression` | The widget was returned and placed on the screen. | The `interactionId` of the recommendation. |
| `sendWidgetView` | The widget scrolled into view. | The `interactionId` of the recommendation. |
| `sendClickView` | The user tapped a product in the widget. | The product ID. |
| `sendSearchClickView` | The user tapped a product in search results. | The product ID. |

`instanceId` is always the ID of the campaign, taken from the recommendation or search response.

Send an impression once per widget per screen load, not on every scroll.

## Banners

If you use Segmentify's banner tracking, report the banners your app shows and the taps on them.

```swift
let banner = BannerOperationsModel()
banner.group = "Home Page Slider"
banner.title = "Summer Sale"
banner.order = 1

let manager = SegmentifyManager.sharedManager()
manager.sendBannerImpressionEvent(segmentifyObject: banner)
manager.sendBannerClickEvent(segmentifyObject: banner)

let slide = InternalBannerModel()
slide.title = "Summer Sale"
slide.image = "https://cdn.yourdomain.com/banners/summer.jpg"
slide.order = 1
slide.urls = ["https://www.yourdomain.com/summer"]

let group = BannerGroupViewModel()
group.group = "Home Page Slider"
group.banners = [slide]
manager.sendBannerGroupViewEvent(segmentifyObject: group)
```

| Method | When |
| --- | --- |
| `sendBannerGroupViewEvent` | A banner group (for example a slider) is shown, with the banners in it. |
| `sendBannerImpressionEvent` | One banner became visible. |
| `sendBannerClickEvent` | The user tapped a banner. |
| `sendBannerUpdateEvent` | A banner's content changed. |

`group` is the name of the banner area and must be the same in every event for that area.
