Skip to main content

Contextual advertising in mobile apps: which screen signals to use

Build an ad taxonomy, set rules for individual screens, and keep user data out of ad requests.

R
Written by Reiko

Contextual advertising matches an ad to the content of a screen or an action in the app. A recipe catalog might use its baking section as the cue, a travel service might use a train station listing, and a game might use the end of a level. The engineering work is to describe that context with a few stable signals and send them through an interface the ad partner supports.

​

Keep screen categories separate from visitor data

Developers can tag a collection called “Weekend Routes” as travel.outdoors in advance and use the tag to select an in-house placement or a direct campaign. That decision needs no details from a personal itinerary, precise coordinates, or text entered in search. Classifying by screen template produces a predictable result even when the device is offline.

​

Use three layers. The first is the page type, such as a catalog, detail page, results screen, or settings. The second is the topic from the product taxonomy. The third covers placement attributes such as ad format and interface language, where the integration accepts them. A few dozen categories are usually enough for a catalog app. An overly granular taxonomy fragments traffic and makes performance harder to compare across screens.

​

Document each ad placement

Field

Recipe detail screen

ID

recipe_detail_inline

Context

food.baking

Load trigger

The recipe is open and the placement is approaching the viewport

Excluded data

Private notes, user search text, and account identifiers

Fallback

A neutral campaign or a recipe card without ads

Owner

The catalog team assigns the category. The monetization team manages the campaign

Use this specification when adding a screen. The recipe list and the editor for a personal collection might reuse the same UI component while requiring different ad settings. Bind the rules to the route or product state so the component does not automatically carry ad behavior with it.

​

Before connecting an ad network

  1. List ad placements and the source of each field. Mark which values come from the app and which are supplied through remote configuration.

  2. Define an allowlist of categories. Map unknown values to a general category or skip the impression. Apply the same validation to embedded web content.

  3. Document which fields the partner supports. When its SDK cannot accept the page category, keep the field for your own analytics or direct campaigns. Separate placement IDs alone do not guarantee contextual matching by the provider.

Handle edge cases in the catalog and feed

A recipe card may display a title edited by the user. Send the catalog-assigned category and keep the title in the app. A post in a user feed can be removed or reclassified after an ad request is sent. If an editor changes its topic after loading, the app needs to fetch fresh context from the catalog. Leave the placement empty until that context is available.

​

Review requests whenever you add a partner or adapter. Open the same screen with two accounts and in an anonymous session, then compare the requests. The classification fields should agree when all three sessions show the same card. Test logs only need to show field names, sample taxonomy values, and confirmation that user text was absent.

​

How a pie recipe gets an ad

A catalog can run campaigns for baking, kitchen goods, and general merchandise at the same time. The first two match a pie recipe on topic. The third is the fallback. Exclude campaigns that have expired or reached their impression caps before applying priority. Log why a candidate was excluded. A topic mismatch, exhausted budget, and a disabled placement call for different fixes.

​

Decide where the taxonomy is maintained. When editors rename “Baking” to “Homemade Bread,” its internal tag can stay the same. When they split the section in two, issue new tags and keep the old one valid during the transition. Older clients can then keep working while newer builds send more precise context. Record the date of the taxonomy change so that a break in the reporting series is not mistaken for lost demand.

​

How to tell whether categories are working

Compare fill rate, revenue per thousand impressions, and off-topic ads for each screen group. Rising revenue alongside worse relevance calls for a review of the creatives and campaign eligibility rules. When a category gets too few requests, roll it into the parent category and run the comparison again on a larger group.

​

Design the data flow from screen to request

A recipe can open from the catalog, favorites, or an external link. Its topic should be the same along all three routes. Basing the category on the previous screen might classify a favorites visit as “personal” and an entry from a notification as “other.” Attach the category to the catalog record and log the entry point in navigation analytics, where it can explain how readers reach the recipe.

​

Separate context creation from request assembly. The screen reports that a public recipe with an allowed category is open. A central component checks whether the placement can serve an ad and which parameters the selected provider accepts. Send only fields in that contract. New fields in the recipe model remain in the app until someone explicitly adds them to the contract.

Input signal

How to handle it

Reason

Catalog category

Send after checking the taxonomy and the partner contract

It describes public content

User-defined list name

Keep inside the app

It may contain names or private notes

Interface language

Use where the integration supports it

The creative's language should match what the reader expects

UI route

Map to a fixed placement ID

Route parameters may carry record identifiers

Unknown tag

Map to an approved general category or skip the impression

New screens should follow the default rules

Resolve competing topics on the same screen

A product detail page usually has a clear topic. A mixed feed can show news, reviews, and recommendations side by side. Use the editorial section category for a feed-wide slot. A slot attached to a specific group of items can use that group's topic. Classifying from whichever item lands next to the slot is unreliable: two readers can open the same section and get different targeting solely because cards finish loading in a different order.

​

A screen can change modes without changing routes. A public itinerary may open a panel for creating a personal copy. The public screen stays in memory, but the visitor is now working with private fields. Ads should be disabled in that mode. A route-only rule would still mark the page eligible with the editor open. Evaluate the current UI mode at show time as well as at load time.

​

Pair the targeting category with a flag that can suppress serving. A help article about recovering access may belong to a valid help category and still need to stay ad-free. An explicit flag is easy to test and explain. Let the content owner apply the exclusion when judgment is needed, without asking the system to infer it from free-form headlines.

​

Keep context in sync during fast navigation

A visitor opens Baking, switches straight to Breakfast, and receives the response for Baking while already on Breakfast. Attach the placement, local context version, and show deadline to the outgoing request. Compare all three with current state when the response arrives. A stale creative must never replace an ad already on the new screen.

​

Give preloaded ads a cache key. For direct campaigns that key can combine the placement, category, format, and rule version. The campaign end time limits how long the creative can be cached. Reusing an ad in another placement needs its own check, even when the two containers are the same size. An offline catalog can know a recipe's topic without having a fresh ad. Use the fallback block or hide the placement without restarting the load every time the reader scrolls.

​

Acceptance tests for the product team

  1. Open a public item from the list, saved items, and a deep link. Expect the same topic and the placement ID assigned to that screen each time.

  2. Open an editor, a screen with an unknown category, and a private note. Compare each request with its placement specification. The request body must contain neither private notes nor raw search text.

  3. Reproduce out-of-order responses, a language change, and a configuration rollback. Record the expected creative and the reason each other candidate is excluded.

  4. When you update the taxonomy, compare client versions by unknown-tag rate, general-category use, and the number of screens left without an ad.

Keep a reference set of cards that includes a clear topic, mixed content, a private screen, and an unknown tag. Have one person classify the items by hand and another match test-build requests to the expected taxonomy. Describe a failure using actual field values and the screen where it occurred. “Shows an irrelevant ad” leaves the cause open: content classification, cache, campaign boundaries, or network parameters.

​

Read the fallback report

In a week the baking section sent 20,000 requests. Of those, 14,000 got a contextual campaign and 4,000 got a fallback. Contextual coverage was 70% of all requests, while overall fill was 90%. Combining those two response categories hides how well the taxonomy supports contextual matching.

​

A narrower category reduced contextual coverage to 45%, while manual relevance scores rose. To see whether the new segment has enough demand, compare the parent category, new subcategory, and a neutral control. Use the same format and placement for all three groups so that changes in visibility do not distort the comparison.

Documentation

Did this answer your question?