AdEngine Custom Targeting

 

 

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.

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

Sites might have multiple authors writing articles, and it is required to know how many impressions each individual has generated with their content, that's possible using the Custom Targeting.
For example, there are three authors Lili, Robin, and Barney, if each one of them is associated with a number, it can be used to set the target using those numbers and fetch reports with the individual data for each author.

Find out trends for different page categories

It's important to know which page categories are generating views and what categories are not so that we can focus more on the first, that's possible using the Custom Targeting.
For example, there are pages related to Computing and Technology, and on these pages are the following categories News, Sales, and Reviews. Each category has a unique number assigned that is used for targeting, to then fetch reports with the individual data for each category.

Syntax

Custom targeting can be configured using AdEngine Declarative Configuration.
Setting an integer from 1-100 in the snigelPubConf.adengine.targeting.key1 associate that value to all the units served by AdEngine on this page.

<script data-cfasync="false" type="text/javascript"> window.snigelPubConf = { "adengine":{ "targeting": { "key1": Number } } }; </script> <script data-cfasync="false" async src="https://cdn.snigelweb.com/adengine/**site.domain**/loader.js" type="text/javascript"></script>

Note:

  • "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.

 

Â