Skip to content

Commit eae53f7

Browse files
author
James Lou
committed
Add documentation for iOS ORTB response custom parsing
1 parent 33bef66 commit eae53f7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

prebid-mobile/pbm-api/ios/pbm-targeting-ios.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,26 @@ Pay attention that there are certain protected fields such as `regs`, `device`,
585585
- App and User first party data should use the [functions defined for those purposes](/prebid-mobile/pbm-api/ios/pbm-targeting-ios.html#first-party-data)
586586
- See the [Prebid Server auction endpoint](/prebid-server/endpoints/openrtb2/pbs-endpoint-auction.html#prebid-server-ortb2-extension-summary) reference for more information about how it will process incoming fields.
587587

588+
## ORTB Response Customization
589+
590+
Prebid SDK allows customizing the parsing of the of and the types used to represent the ORTB respnse. Use `CustomModelObjects.registerCustomType(_:)` to specify the custom types to use and override the `init(jsonDictionary:)` with custom parsing logic.
591+
592+
``` swift
593+
class MyCustomORTBBidResponse: ORTBBidResponse {
594+
595+
var myCustomField: String?
596+
597+
required init(jsonDictionary: [String : Any]) {
598+
myCustomField = jsonDictionary["customString"] as? String
599+
super.init(jsonDictionary: jsonDictionary)
600+
}
601+
}
602+
603+
CustomModelObjects.registerCustomType(MyCustomORTBBidResponse.self)
604+
```
605+
606+
You can use this to access custom or unsupported fields from the prebid response, or to modify the response at your own risk.
607+
588608
## Further Reading
589609

590610
- [Prebid Mobile Overview](/prebid-mobile/prebid-mobile.html)

0 commit comments

Comments
 (0)