Skip to main content

Advanced Settings

Global Settings

Logs

BidMachine SDK provides a set of logging options to help you debug and monitor the SDK's behavior. You can enable or disable different types of logs, such as general logs, bid logs, and event logs.

BidMachine.setLoggingEnabled(Boolean)

Test Mode

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

BidMachine.setTestMode(Boolean)
warning

Test mode should be disabled in production.

Location

SDK can automatically track user device location to serve better ads. To make it work for Android 6.0, you should request android.permission.ACCESS_COARSE_LOCATION and android.permission.ACCESS_FINE_LOCATION:

ActivityCompat.requestPermissions(Activity, arrayOf<String>(
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_FINE_LOCATION
), REQ_CODE)

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(Publisher?)
ParamTypeDescription
IdStringPublisher ID
NameStringPublisher name
DomainStringPublisher domain
CategoryStringPublisher content category

Code Example:

val publisher = Publisher.Builder()
.setId(String?)
.setName(String?)
.setDomain(String?)
.addCategory(String?)
.addCategories(List<String>?)
.build()

// Sets publisher information
BidMachine.setPublisher(publisher)

Targeting Parameters

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

val targetingParams = TargetingParams()
.setUserId(String?)
.setGender(Gender?)
.setBirthdayYear(Int?)
.setKeywords(vararg String?)
.setDeviceLocation(Location?)
.setCountry(String?)
.setCity(String?)
.setZip(String?)
.setStoreUrl(String?)
.setStoreCategory(String?)
.setStoreSubCategories(vararg String?)
.setFramework(String?)
.setPaid(Boolean?)
.setExternalUserIds(List<ExternalUserId>?)
.addBlockedAdvertiserIABCategory(String)
.addBlockedAdvertiserDomain(String)
.addBlockedApplication(String)

TargetingParams can be passed with 2 ways:

  • Through global parameters:
BidMachine.setTargetingParams(targetingParams)
  • Through ad request builder:
adRequestBuilder.setTargetingParams(targetingParams)

You can combine global parameters with regular. If you set Global TargetingParams using UserId, and then make a request using TargetingParams with Gender set, both requests will be merged and the resulting TargetingParams will include both UserId and Gender.

Priority of Targeting Parameters

Priority is given to the AdRequest 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 the US dollars.

If you use the method with only Price provided PriceFloorParams.addPriceFloor(Double), the Id will be generated using UUID.randomUUID().

val priceFloorParams = PriceFloorParams()
// Set Bid Price, in this case id will be generated
.addPriceFloor(Double)
// Set Bid Id and Price
.addPriceFloor(String, Double)
ParameterTypeDescription
IdStringUnique floor identifier.
PricedoubleFloor price

To set up price floor parameters for ad request use setPriceFloorParams method from AdRequest builder according to ads type.

adRequestBuilder.setPriceFloorParams(priceFloorParams)

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.

val customParams = CustomParams()
.addParam(String, String)
.addParams(Map<String, String>)

To set up custom parameters for ad request use setCustomParams method from AdRequest builder according to ads type.

adRequestBuilder.setCustomParams(customParams)

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 AdRequestListener. Use AuctionResult from onRequestSuccess callback
adRequestBuilder.setListener(object : <AdRequestObject>.AdRequestListener {
override fun onRequestSuccess(adRequest: <AdRequestObject>,
auctionResult: AuctionResult) {
// Use AuctionResult from onRequestSuccess callback
}
});
  • Through getter. Each AdRequest has an option to retrieve auction result information after it has been loaded.
adRequest.auctionResult
ParameterTypeDescriptionSample
IdStringWinner bid ID provided in the request.cc5bd14b-aaef-4037-b4f8-879913366e3c
Demand SourceStringWinner advertising source name.BidMachine Test
PricedoubleWinner price expressed as CPM.0.023
DealStringId of Price Floor.d6f61bf9-11a8-4172-a77d-4b1ff85a727f
Creative IdStringWinner creative id.123.13579
CIDStringWinner Campaign ID or other similar grouping of brand-related ads.123.13587
Ad DomainArray of StringWinner advertiser domain (top two levels only, e.g., “ford.com”).["sample1.com", "sample2.com"]
Network KeyStringWinner network key. This network will be loaded.mraid
Network ParamsMap, String - StringClient parameters of winner networks.
Creative FormatEnumCreativeFormat, one of: Banner, Video, Native.CreativeFormat.Video
Custom ParamsMap, String - StringMap that contains additional information about the response.

Win/Loss notifications

Call notifyMediationWin/notifyMediationLoss on the AdRequest instance when BidMachine wins/loses the mediation among networks.

  • Win notification:
adRequest.notifyMediationWin()
  • Loss notification:
adRequest.notifyMediationLoss("<WINNER_NETWORK_NAME>", <WINNER_NETWORK_PRICE>)
// or
adRequest.notifyMediationLoss()