# Initialize Mediation

## Chartboost Mediation as a Chartboost Core Module

Starting Chartboost Mediation 5.X series, Chartboost Mediation has become a module for [Chartboost Core Unity SDK](/en/mediation/integrate/core/unity/). Initialization is automatically handled when `ChartboostCore.Initialize` is called. Please refer to [Chartboost Core Unity SDK](/en/mediation/integrate/core/unity/) documentation on details for how to manage the Chartboost Core initialization process.

## CoreModuleId

The `ChartboostMediation.CoreModuleId` can be used to identify the Chartboost Mediation Core `Module` initialization status. To be notified of Chartboost's Mediation initialization status, you can utilize the `ChartboostCore.ModuleInitializationCompleted` as seen below:

```csharp
ChartboostCore.ModuleInitializationCompleted += result =>
{
    // If not Chartboost' Mediation, then ignore since we only care about CBMediation in this case.
    if (result.ModuleId != ChartboostMediation.CoreModuleId)
            return;

    Debug.Log($"Received initialization result for: {result.ModuleId} start:{result.Start}, end:{result.End} with duration: {result.Duration}");

    // Module failed to initialize module
    if (result.Error.HasValue) 
        Debug.LogError($"Module: {result.ModuleId} failed to initialize with error: {JsonTools.SerializeObject(result.Error.Value)}");
    // Modue succeeded to initialize, add to list of modules to skip to pass on the next ChartboostCore.Initialize call.
    else
        modulesToSkip.Add(result.ModuleId);
};
```

## SetPreInitializationConfiguration

Sets the Chartboost Mediation `PreInitialization` configuration and should be set before initialization. Setting this after initialization does nothing and returns an exception. Utilize this to skip partner initialization.

```csharp
// List of partners ids to skip initialization
HashSet<string> skippablePartnerIds = new HashSet<string>
{
    ChartboostAdapter.PartnerIdentifier,
    MetaAudienceNetworkAdapter.PartnerIdentifier
};

// Create ChartboostMediationPreInitializationConfiguration object
ChartboostMediationPreInitializationConfiguration preinitializatioOptions = new ChartboostMediationPreInitializationConfiguration(skippablePartnerIds);

// Set ChartboostMediationPreInitializationConfiguration object
ChartboostMediationError? error = ChartboostMediation.SetPreInitializationConfiguration(preinitializatioOptions);

// Report if failed to set ChartboostMediationPreInitializationConfiguration object
if (error.HasValue) 
    Debug.LogError($"Failed to set PreInitializationConfiguration: {JsonTools.SerializeObject(error.Value)}");
```

In the example above, both `Chartboost` and `MetaAudienceNetwork` adapters are added to the `skippablePartnerIds` object. This will cause initialization for those partner adapters to be skipped. 


| Partner                           | Identifier           | API Reference                                    |
| --------------------------------- | -------------------- | ------------------------------------------------ |
| AdMob                             | admob                | AdMobAdapter.PartnerIdentifier                   |
| Amazon Publisher Services         | amazon_aps           | AmazonPublisherServicesAdapter.PartnerIdentifier |
| AppLovin                          | applovin             | AppLovinAdapter.PartnerIdentifier                |
| BidMachine                        | bidmachine           | BidMachineAdapter.PartnerIdentifier              |
| Chartboost Monetization           | chartboost           | ChartboostAdapter.PartnerIdentifier              |
| Digital Turbine Exchange (Fyber)  | fyber                | DigitalTurbineExchangeAdapter.PartnerIdentifier  |
| HyprMX                            | hyprmx               | HyprMXAdapter.PartnerIdentifier                  |
| Google Bidding                    | google_googlebidding | GoogleBiddingAdapter.PartnerIdentifier           |
| InMobi                            | inmobi               | InMobiAdapter.PartnerIdentifier                  |
| ironSource                        | ironsource           | IronSourceAdapter.PartnerIdentifier              |
| Liftoff Monetize (Vungle)         | vungle               | VungleAdapter.PartnerIdentifier                  |
| Meta Audience Network             | facebook             | MetaAudienceNetworkAdapter.PartnerIdentifier     |
| Mintegral                         | mintegral            | MintegralAdapter.PartnerIdentifier               |
| MobileFuse                        | mobilefuse           | MobileFuseAdapter.PartnerIdentifier              |
| Pangle                            | pangle               | PangleAdapter.PartnerIdentifier                  |
| Unity                             | unity                | UnityAdsAdapter.PartnerIdentifier                |
| Verve                             | verve                | VerveAdapter.PartnerIdentifier                   |
