# Advanced Configuration

When configuring the SDK you can pass in options that configure Superwall, the paywall presentation, and its appearance.

Logging [#logging]

Logging is enabled by default in the SDK and is controlled by two properties: `level` and `scopes`.

`level` determines the minimum log level to print to the console. There are five types of log level:

1. **debug**: Prints all logs from the SDK to the console. Useful for debugging your app if something isn't working as expected.
2. **info**: Prints errors, warnings, and useful information from the SDK to the console.
3. **warn**: Prints errors and warnings from the SDK to the console.
4. **error**: Only prints errors from the SDK to the console.
5. **none**: Turns off all logs.

The SDK defaults to `info`.

`scopes` defines the scope of logs to print to the console. For example, you might only care about logs relating to `paywallPresentation` and `paywallTransactions`. This defaults to `.all`. Check out [LogScope](https://sdk.superwall.me/documentation/superwallkit/logscope) for all possible cases.

You set these properties like this:

:::android
```kotlin
val options = SuperwallOptions()
options.logging.level = LogLevel.warn
options.logging.scopes = EnumSet.of(LogScope.paywallPresentation, LogScope.paywallTransactions)

Superwall.configure(
  this,
  apiKey = "MY_API_KEY",
  options = options
)

// Or you can set:
Superwall.instance.logLevel = LogLevel.warn

// Or use the configuration DSL
configureSuperwall("MY_API_KEY") {
    options {
        logging {
            level = LogLevel.warn
            scopes = EnumSet.of(LogScope.paywallPresentation, LogScope.paywallTransactions)
        }
    }
}
```
:::

Preloading Paywalls [#preloading-paywalls]

Paywalls are preloaded by default when the app is launched from a cold start. The paywalls that are preloaded are determined by the list of placements that result in a paywall for the user when [registered](/docs/sdk/quickstart/feature-gating). Preloading is smart, only preloading paywalls that belong to audiences that could be matched.

Paywalls are cached by default, which means after they load once, they don't need to be reloaded from the network unless you make a change to them on the dashboard. However, if you have a lot of paywalls, preloading may increase network usage of your app on first load of the paywalls and result in slower loading times overall.

> **Tip**

To make an onboarding or first-launch paywall load before the rest of your campaigns, prioritize the campaign from the dashboard with [Priority Placements](/docs/dashboard/dashboard-campaigns/campaigns-placements-prioritized). Use the SDK methods below when you need to disable automatic preloading or manually preload specific placements.



You can turn off preloading by setting `shouldPreload` to `false`:

:::android
```kotlin
val options = SuperwallOptions()
options.paywalls.shouldPreload = false

Superwall.configure(
  this,
  apiKey = "MY_API_KEY",
  options = options
)

// Or using the configuration DSL
configureSuperwall("MY_API_KEY") {
    options {
        paywalls {
            shouldPreload = false
        }
    }
}
```
:::

Then, if you'd like to preload paywalls for specific placements you can use `preloadPaywalls(forPlacements:)`:

:::android
```kotlin
val eventNames = setOf("campaign_trigger")
Superwall.instance.preloadPaywalls(eventNames)
```
:::

If you'd like to preload all paywalls you can use `preloadAllPaywalls()`:

:::android
```kotlin
Superwall.instance.preloadAllPaywalls()
```
:::

Note: These methods will not reload any paywalls that have already been preloaded.

External Data Collection [#external-data-collection]

By default, Superwall sends all registered events and properties back to the Superwall servers. However, if you have privacy concerns, you can stop this by setting `isExternalDataCollectionEnabled` to `false`:

:::android
```kotlin
val options = SuperwallOptions()
options.isExternalDataCollectionEnabled = false

Superwall.configure(
  this,
  apiKey = "MY_API_KEY",
  options = options
)

// Or using the configuration DSL
configureSuperwall("MY_API_KEY") {
    options {
        isExternalDataCollectionEnabled = false
    }
}
```
:::

Disabling this will not affect your ability to create triggers based on properties.

Automatically Dismissing the Paywall [#automatically-dismissing-the-paywall]

By default, Superwall automatically dismisses the paywall when a product is purchased or restored. You can disable this by setting `automaticallyDismiss` to `false`:

:::android
```kotlin
val options = SuperwallOptions()
options.paywalls.automaticallyDismiss = false

Superwall.configure(
  this,
  apiKey = "MY_API_KEY",
  options = options
)

// Or using the configuration DSL
configureSuperwall("MY_API_KEY") {
    options {
        paywalls {
            automaticallyDismiss = false
        }
    }
}
```
:::

To manually dismiss the paywall , call `Superwall.shared.dismiss()`.

Custom Restore Failure Message [#custom-restore-failure-message]

You can set the title, message and close button title for the alert that appears after a restoration failure:

:::android
```kotlin
val options = SuperwallOptions()
options.paywalls.restoreFailed.title = "My Title"
options.paywalls.restoreFailed.message = "My message"
options.paywalls.restoreFailed.closeButtonTitle = "Close"

Superwall.configure(
  this,
  apiKey = "MY_API_KEY",
  options = options
)

// Or using the configuration DSL
configureSuperwall("MY_API_KEY") {
    options {
        paywalls {
            restoreFailed.title = "My Title"
            restoreFailed.message = "My message"
            restoreFailed.closeButtonTitle = "Close"
        }
    }
}
```
:::

Haptic Feedback [#haptic-feedback]

On iOS, the paywall uses haptic feedback by default after a user purchases or restores a product, opens a URL from the paywall, or closes the paywall. To disable this, set the `isHapticFeedbackEnabled` `PaywallOption` to false:

Note: Android does not use haptic feedback.

Transaction Background View [#transaction-background-view]

During a transaction, we add a `UIActivityIndicator` behind the view to indicate a loading status. However, you can remove this by setting the `transactionBackgroundView` to `nil`:

:::android
```kotlin
val options = SuperwallOptions()
options.paywalls.transactionBackgroundView = null

Superwall.configure(
  this,
  apiKey = "MY_API_KEY",
  options = options
)

// Or using the configuration DSL
configureSuperwall("MY_API_KEY") {
    options {
        paywalls {
            transactionBackgroundView = null
        }
    }
}
```
:::

Purchase Failure Alert [#purchase-failure-alert]

When a purchase fails, we automatically present an alert with the error message. If you'd like to show your own alert after failure, set the `shouldShowPurchaseFailureAlert` `PaywallOption` to `false`:

:::android
```kotlin
val options = SuperwallOptions()
options.paywalls.shouldShowPurchaseFailureAlert = false

Superwall.configure(
  this,
  apiKey = "MY_API_KEY",
  options = options
)

// Or using the configuration DSL
configureSuperwall("MY_API_KEY") {
    options {
        paywalls {
            shouldShowPurchaseFailureAlert = false
        }
    }
}
```
:::

Web Purchase Confirmation Alert [#web-purchase-confirmation-alert]

When a user completes a purchase via web checkout (app2web flow), you can control whether to show a confirmation alert. By default, this is set to `false` to prevent duplicate alerts. Set `shouldShowWebPurchaseConfirmationAlert` to `true` if you want to show the native confirmation alert:

:::android
```kotlin
val options = SuperwallOptions()
options.paywalls.shouldShowWebPurchaseConfirmationAlert = true

Superwall.configure(
  this,
  apiKey = "MY_API_KEY",
  options = options
)

// Or using the configuration DSL
configureSuperwall("MY_API_KEY") {
    options {
        paywalls {
            shouldShowWebPurchaseConfirmationAlert = true
        }
    }
}
```
:::

Locale Identifier [#locale-identifier]

When evaluating rules, the device locale identifier is set to `autoupdatingCurrent`. However, you can override this if you want to test a specific locale:

:::android
```kotlin
val options = SuperwallOptions()
options.localeIdentifier = "en_GB"

Superwall.configure(
  this,
  apiKey = "MY_API_KEY",
  options = options
)

// Or using the configuration DSL
configureSuperwall("MY_API_KEY") {
    options {
        localeIdentifier = "en_GB"
    }
}
```
:::

For a list of locales that are available on iOS, take a look at [this list](https://gist.github.com/jacobbubu/1836273). You can also preview your paywall in different locales using [In-App Previews](/docs/sdk/quickstart/in-app-paywall-previews).

Game Controller [#game-controller]

If you're using a game controller, you can enable this in `SuperwallOptions` too. Check out our [Game Controller Support](/docs/sdk/guides/advanced/game-controller-support) article.

Take a look at [SuperwallOptions](https://sdk.superwall.me/documentation/superwallkit/superwalloptions) in our SDK reference for more info.