Targeting

Targeting is an important technique that improves the CPM of on-page units. For example, a weather site could indicate to bidders that it’s a hot and sunny day in the user’s location.

Targeting consists of:

  • A key which indicates the type of target, e.g. weather
  • A value which indicates the value for the target. It may be a single string hot or an array of strings [hot, sunny]

Fuse supports targeting at two levels:

  • Page-level targeting, which applies to all Zones on the page
  • Zone-level targeting, which applies to a single, specific Zone.

If Zone targeting is set for a key which was also set at the Page level, the Zone targeting takes precedence over the page targeting for that key.

Page-level targeting

Page level targeting applies to all zones on the page, unless overridden for a specific Zone and key.

Statically Initialised sites

For static sites, it is generally easiest to set the targeting in a <script> block defined in the <head> section.

For example:

<head>
    <!-- omitted -->

    <script>
        // Get an initialisation-safe reference to the Fuse Queue
        const fusetag = window.fusetag || (window.fusetag = { que: [] });

        fusetag.que.push(function () {
            fusetag.setTargeting('weather', ['hot', 'sunny']);
            fusetag.setTargeting('age', '18-39');
        })
    </script>
</head>

Dynamically Initialised sites

For single page applications, it is easiest to apply page targeting as part of the fusetag.pageLoadComplete call. For example:

// Get an initialisation-safe reference to the Fuse Queue
const fusetag = window.fusetag || (window.fusetag = { que: [] });

fusetag.que.push(function() {
    // Indicate that the core load is complete, and that page targeting
    // should be applied to the 'weather' and 'age' keys
    fusetag.pageInit({
        pageTargets: [
            {
                'key': 'weather',
                'value': ['hot', 'sunny'],
            },
            {
                'key': 'age',
                'value': '18-39',
            },
        ]
    });
});

It’s important to note that all page-level targeting is cleared and must be re-applied whenever a pageInit call occurs.

// Get an initialisation-safe reference to the Fuse Queue
const fusetag = window.fusetag || (window.fusetag = { que: [] });

fusetag.que.push(function() {
    // Indicate that the core load is complete, and that page targeting
    // should be applied to the 'weather' and 'age keys
    fusetag.pageInit({
        pageTargets: [
            {
                'key': 'weather',
                'value': ['hot', 'sunny'],
            },
            {
                'key': 'age',
                'value': '18-39',
            },
        ]
    });
});

Zone Targeting

Targeting may also be applied to a specific Zone. This overrides any targeting applied at the Page level, on a key-by-key basis.

Zone targeting is applied directly into the DOM using attributes, and must be set before the Zone is registered.

  • Targeting attributes are structured as follows: data-targeting-<key>=<value>
  • value may either be a single string or a comma-delimited string which is converted to an array of strings.

For example:

<div
        id="first-ad"
        data-fuse="123123155"
        data-targeting-weather="hot,sunny"
        data-targeting-age="18-39"
></div>

Is translated to custom targeting of:

  • weather = [‘hot’, ‘sunny’]
  • age = [18-39']