Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

AdEngine supports custom targeting for each ad unit served. This can be done by setting a value between 1-100 to the snigelPubConf.adengine.targeting.key1.

Info

The implementation of AdEngine custom targeting may not work for SPA sites (see Exceptions).

Examples

Associating article pages to their authors to measure the impressions they have generated

...

  • "key1" must always have a single number (1-100) associated, e.g.: "key1": 54

  • Please let your account manager know in case you need more key-value pairs

  • Replace **site.domain** with the actual site domain

Exceptions

Implementing this custom targeting may not work correctly for SPA pages. Taking the previous example and the way AdEngine Custom Targeting works, to target each page with a different key-value, it is necessary to:

  1. Create a new snigelPubConf object with a new key-value

  2. Load AdEngine script again to read the new snigelPubConf

For SPA pages this doesn't happen, you don't load AdEngine script every time a user changes pages, as the objective of this type of page is not to have to load all the page's resources, making the load and navigation between pages faster, increasing the site’s performance.

Solution

An alternative solution is to do manual targeting every time a user changes pages. For that, implement an event that is fired when the user changes the page, and within that event call the following function:
googletag.pubads().setTargeting(key: string, value: string | string[])

To know more about this function, consult this page.