- For one Content Ignite unit depending on another Content Ignite unit, use the automatic body helper classes added by the tag. This does not require any publisher development work.
- For a unit depending on an external page process, use a publisher-controlled body class that is added when that process is ready.
document.body. When a body class changes, it checks targeting again, finds any newly matching configs, and loads the units that are now eligible.
Gating a unit with a body class
Say a config normally targets this container:Normal targeting
1 has returned empty:
Dependent targeting
ci-1-empty class exists on the page, the selector will not match. If config 1 receives no ad, the Publisher Tag adds ci-1-empty to document.body, target matching runs again, and the dependent MPU becomes eligible to load.
Body helper classes are added to
document.body, so they should be used as a
prefix before the dependent unit’s normal selector.Depend on another ad unit
A common example is a skin or takeover unit. You may want the skin to have the first opportunity to serve. If it does not return an ad, you then unlock one or more fallback units such as MPUs or skyscrapers. In this example:- Config
1is the skin or takeover unit. - Config
2is an MPU that should only load if config1misses. - Config
2normally targets.ad-mpuin Fusion.
2’s selector to:
Fallback targeting
ci-1-empty to the body when config 1 has no available ads to serve. Because config 2 only matches after that class exists, it will not load unless config 1 has attempted to serve and returned empty.
You can use the same prefix on multiple fallback configs. For example, both a desktop skyscraper and an MPU could use selectors that start with .ci-1-empty if both should wait for the skin to miss.
The available unit-state helper classes are:
ci-{CONFIG_ID}- added when at least one target match for the config is present on the page.ci-{CONFIG_ID}-open- added when at least one of the config’s units is open on the page.ci-{CONFIG_ID}-empty- added when there are no available ads to serve for the config, and therefore the unit is not shown.
Depend on an external process
Another common dependency is a client-side user authentication or subscription service. For example, a publisher may need to pass a subscription state into ad targeting before any ad requests are made. If ads load before the auth service is ready, some requests may go out without the required value. To avoid that race condition, prefix the affected unit selectors with a class such asshow-ads:
Auth-gated targeting
Unlock ads after auth is ready
.setTargeting() before adding the body class. Adding show-ads causes target matching to run again, so the targeting value should already be queued before dependent units become eligible to load.
Avoid blocking ads forever
If an external dependency can fail, timeout, or be blocked by a browser extension, add a fallback path. Otherwise the gated units may never become eligible to load.Auth dependency with a fallback
Implementation checklist
- Gate only the units that need the dependency. Leave unrelated units loading normally.
- For unit-to-unit dependencies, use the automatic helper class for the config being depended on, such as
ci-1-empty. - For external dependencies, add the publisher-controlled class to
document.body, not to the individual ad container. - If using JS API targeting, set targeting before adding the body class.
- Include a fallback if the dependency is controlled by a third-party or publisher-owned service.
- Test with ad debugging parameters and browser developer tools to confirm the class is added, target matching reruns, and the dependent config loads.