Skip to main content

Advanced Settings

Global Settings

Logs

BidMachine SDK provides logging options to help you debug and monitor the SDK's behavior.

BidMachine.SetLoggingEnabled(true);

Test Mode

BidMachine SDK can be configured to run in test mode, which is useful for testing and debugging purposes.

BidMachine.SetTestMode(true);
warning

Test mode should be disabled in production.

Publisher Parameters

The publisher info is used to provide information about the publisher of the app. This information is used for targeting and reporting purposes.

BidMachine.SetPublisher(new Publisher
{
Id = "1",
Name = "Publisher Name",
Domain = "publisher.com",
Categories = new[] { "sports", "technology" }
});
ParameterTypeDescription
IdstringPublisher ID
NamestringPublisher name
DomainstringPublisher domain
Categoriesstring[]Publisher content categories

Targeting Parameters

The targeting info is used to provide information about the user and the app.

var targetingParams = new TargetingParams
{
UserId = "user123",
UserGender = TargetingParams.Gender.Male,
BirthdayYear = 1990,
Keywords = new[] { "games", "sports" },
DeviceLocation = new TargetingParams.Location
{
Provider = "GPS",
Latitude = 48.8566,
Longitude = 2.3522
},
Country = "FR",
City = "Paris",
Zip = "75001",
StoreUrl = "https://play.google.com/store/apps/details?id=com.example.app",
StoreCategory = "Games",
StoreSubCategories = new[] { "Action", "Multiplayer" },
IsPaid = false,
ExternalUserIds = new[]
{
new ExternalUserId { SourceId = "ad_network_1", Value = "value_1" },
new ExternalUserId { SourceId = "ad_network_2", Value = "value_2" }
},
BlockedDomains = new HashSet<string> { "blocked.com" },
BlockedCategories = new HashSet<string> { "IAB25" },
BlockedApplications = new HashSet<string> { "com.unwanted.app" }
};

BidMachine.SetTargetingParams(targetingParams);

TargetingParams can be passed in two ways:

  • Globally — applied to all ad requests:
BidMachine.SetTargetingParams(targetingParams);
  • Per ad request — via the request builder:
new InterstitialRequest.Builder(config)
.SetTargetingParams(targetingParams)
// ...
.Build();

You can combine global parameters with per-request parameters. If you set global TargetingParams with UserId, and then make a request with TargetingParams that has UserGender set, the resulting parameters will include both UserId and UserGender.

Priority of Targeting Parameters

Priority is given to the per-request parameters.

Auction Request Settings

Price Floor Parameters

The price floor info is used to set a minimum price for the ad unit. You can pass multiple price floors for one ad request.

Price Floor Currency

The price floor is always in US dollars.

If you use the method with only price provided, the id will be generated automatically using Guid.NewGuid().

var priceFloorParams = new PriceFloorParams()
.AddPriceFloor(0.01) // auto-generated id
.AddPriceFloor("custom_price_floor_id", 0.02); // explicit id
ParameterTypeDescription
idstringUnique floor identifier
pricedoubleFloor price

To set up price floor parameters for an ad request, use SetPriceFloorParams on the request builder:

new InterstitialRequest.Builder(config)
.SetPriceFloorParams(priceFloorParams)
// ...
.Build();

Placement Settings

Custom Parameters

You can pass custom parameters in the placement object to be sent to the server. Custom parameters is a dictionary of key-value pairs that can be used for targeting or reporting purposes.

var customParams = new CustomParams()
.AddParam("mediation_mode", "pdb_is");

To set up custom parameters for an ad request, use WithCustomParams on the placement config builder:

var config = AdPlacementConfig.InterstitialBuilder(AdContentType.All)
.WithPlacementId("my_placement")
.WithCustomParams(customParams)
.Build();

Auction Info

The auction info provides details about the ad auction, including bid ID, creative ID, deal ID, campaign ID, demand source, price, and custom parameters.

You can get AuctionResult in two ways:

  • Through the request listener callback:
public void onRequestSuccess(IAdRequest request, AuctionResult auctionResult)
{
var bidId = auctionResult.BidId;
var price = auctionResult.Price;
}
  • Through the request object after it has been loaded:
AuctionResult result = request.GetAuctionResultObject();
ParameterTypeDescription
BidIdstringWinner bid ID
DemandSourcestringWinner advertising source name
PricedoubleWinner price expressed as CPM
DealIdstringID of the price floor
CreativeIdstringWinner creative ID
CidstringWinner campaign ID or other similar grouping of brand-related ads
CustomParamsCustomParamsAdditional parameters about the response
CustomExtrasCustomExtrasWinner unit extras