Search code examples
iosadsgoogle-dfpadmob

How to set custom targeting in Native ad GADRequest in iOS?


I am able to set custom targets for DFPRequest in case of banner ads.we can send like this in DFP request.

let request = DFPRequest()
request.customTargeting = [string:string]

When it comes to Native/Sponsored ads, how to set custom targets?

let request = GADRequest()

In GADRequest, i am not able to find any customTargeting property.Only DFPRequest detailing is given on google developer site.

https://developers.google.com/mobile-ads-sdk/docs/dfp/ios/targeting#publisher_provided_identifiers


Solution

  • I think you can load DFPRequest from native ads. Below is the code,

    adLoader.load(DFPRequest())
    

    So that you can target. I'm not sure of it. So please check the documentation. Here below is the link I'm providing you to check out the use case.

    The loadRequest method in GADAdLoader accepts the same DFPRequest objects as banners and interstitials. You can use request objects to add targeting information, just as you would with other ad types.

    Link for above: https://developers.google.com/mobile-ads-sdk/docs/dfp/ios/native