Why Use Suggested Ad Units?
A simple use case for suggested ad units is for new publishers or blog owners to create new tags for articles and posts on their site and approve suggested ad units based on the number of impressions they generate. This gives you the chance to see how well your content does before targeting line items to your ad units. The ApproveSuggestedAdUnitsExample from the client libraries will show you how to do this.
A more involved use case for publishing platforms is to tag all the pages generated by the users and perform some operations on content that generates a sizable number of impressions. These operations can include:
- Approving the suggested ad unit and targeting line items to it
- Promoting the page as featured content
- Recognize the user for quality content and auto-approve their pages
// Set the number of requests to 50 or more. Long NUMBER_OF_REQUESTS = 50L; // Statement to fetch suggested ad units in descending order by number of // requests. String statementText = "ORDER BY numRequests DESC LIMIT 500"; Statement filterStatement = new StatementBuilder(statementText).toStatement(); SuggestedAdUnitPage page = new SuggestedAdUnitPage(); // List of suggested ad unit ids to approve. List<String> suggestedAdUnitIds = new ArrayList<String>(); page = suggestedAdUnitService.getSuggestedAdUnitsByStatement( filterStatement); if (page.getResults() != null) { for (SuggestedAdUnit suggestedAdUnit : page.getResults()) { if (suggestedAdUnit.getNumRequests() >= NUMBER_OF_REQUESTS) { // Add it to the ID list to be approved. suggestedAdUnitIds.add(suggestedAdUnit.getId()); /* * Promoting the page as a featured content. * Recognize the user for quality content and auto-approve their * pages. */ } } } if (suggestedAdUnitIds.size() > 0) { // Modify statement to select suggested ad units from the list. filterStatement.setQuery( "WHERE id IN (" + StringUtils.join(suggestedAdUnitIds, ",") + ")"); // Create action to approve suggested ad units. ApproveSuggestedAdUnit action = new ApproveSuggestedAdUnit(); // Perform the action. UpdateResult result = suggestedAdUnitService.performSuggestedAdUnitAction( action, filterStatement); }These are just some of the things we think suggested ad units can be used for; we'd love to hear your ideas on our forum or at an Office Hours Hangout.