# Inline Banners

Apps often have inline elements — whether in the form of monetized ad banners, a card promoting a feature, or a discount offer, etc. — that blends in in the UI, without interrupting users like pop ups do. The challenge with logging conversions for these inline elements is that they not always have clear "outcomes", as users might simply never interact with them. Here is where [Alternative Outcomes](/context-decision/advanced/alternative-outcomes.md) really come in handy.

## Dynamically Hiding The Banner

In this section, let's use the example of an inline banner upselling a subscription that shows up while the user is scrolling a feed, like this:

<figure><img src="/files/GDXxkTyfQpYXjla5xTms" alt="" width="188"><figcaption></figcaption></figure>

The goal is to prevent the banner from being displayed when users are unlikely to interact with it.

### Capturing Context

The right moment to capture the context is when you're about to present it. In this case of a scrolling view, it should be right before it gets rendered on the screen.

{% hint style="info" %}
Visit [Logging Conversions](/context-decision/logging-conversions.md#capturing-context) if you need a refresher on how to capture context.
{% endhint %}

### Logging Conversions

After capturing the context, check the context's `shouldUpsell` property to see if your banner should be displayed or not. If not, log `skipped`, as usual. If it ends up being displayed, you'll need to log different types of outcomes, depending on the user's interactions:

* `negativeNotInteracted`: at a suitable later point, such as when the user closes the app or exits the screen displaying the banner. In our example, it will be when the user scrolls past the banner and the banner gets un-rendered.

  To handle this, use the `context.logIfNotLoggedYet` method, e.g.:

  ```swift
  func applicationDidEnterBackground(_ application: UIApplication) {
      guard let context = ContextManager.recentContext(flowName: "onboarding_upsell") else { return }
      context.logIfNotLoggedYet(.negativeNotInteracted)
  }
  ```
* `positiveInteracted`: when the user taps on the banner or its CTA, opening its paywall, for instance.
* `negativeDismissed`: when the user clicks on the 🅧 button to remove the banner from the screen.
* `negative`: when the user dismisses the paywall (they clicked because they were curious but didn’t purchase anything and dismissed it).
* `positive`: when the user purchases something inside the paywall. Log this using [Revenue Outcomes](/context-decision/revenue-outcomes.md).

For more details about these outcome types, see [Alternative Outcomes](/context-decision/advanced/alternative-outcomes.md).

## Multivariate Monetization

If your app is using a [Multivariate Monetization](/use-cases/multivariate-monetization.md) strategy, the only point of attention is that when `shouldUpsell` is `false` , instead of logging `skipped` and exiting early, you will present the ad banner and log the outcomes as explained in the section above [#logging-conversions](#logging-conversions "mention").

{% hint style="info" %}
Before logging your outcome, don't forget to log which path your app ended up taking by using a [Custom Outcome Metadata](/context-decision/advanced/custom-outcome-metadata.md), such as `"path": "ad"` and `"path": "paywall"`.

For more information, see [Multivariate Monetization](/use-cases/multivariate-monetization.md).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.contextsdk.com/use-cases/inline-banners.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
