phpgoogle-ad-manager

Google Ad Manager PHP Client Library: Retrieving Technology and Device Targeting IDs


I'm using the Google Ad Manager PHP client library to create line items. I've successfully targeted Chrome browsers using the Technology and BrowserTargeting objects with the ID 500072.

How can I:

Retrieve a list of all available technology IDs (e.g., for different browsers) to dynamically build targeting criteria. Target specific devices (e.g., desktop) using the TechnologyTargeting object.

// Target just the Chrome browser.
$browserTechnology = new Technology();
$browserTechnology->setId(500072); // Chrome

// Create technology targeting.
$browserTargeting = new BrowserTargeting();
$browserTargeting->setBrowsers([$browserTechnology]);

$technologyTargeting = new TechnologyTargeting();
$technologyTargeting->setBrowserTargeting($browserTargeting);  

Any guidance on these points would be greatly appreciated.


Solution

  • With the V201905 you can use the PublisherQueryLanguageService to retrive a list of browser to get your desired mapping:

    https://developers.google.com/ad-manager/api/reference/v201905/PublisherQueryLanguageService#browser