Precise AdX, AdSense and OB Revenue on Custom Dimensions

Precise AdX, AdSense & OB Revenue

Precise AdX, AdSense and OB Revenue on Custom Dimensions

For precise revenue on custom dimensions, we need to set up key-values in GAM and tell the AY-Client which dimensions to use for the high accuracy.

If you would like us to generate the 5000 key values automatically with a script please follow step 1.1 and 1.2, otherwise step 1.1 can be skipped.

1.1 Service Account Access

  1. Navigate to Admin -> Global Settings and click the Add Service Account User button under General.
  2. Enter the following details:
    1. Name -> AY Key-Value Gen
    2. Email & Confirm Email ->
    3. Role -> Administrator

That's it. You can remove this account again after we have added the key-values.

1.2 Key-Value Configuration

  1. Navigate to Inventory -> Key-values and click the New key-value button.
  2. Fill in the form with the following information:
    1. Name -> ay_hash
    2. Value type -> Predefined
    3. Report on values -> Include values in reporting & add key as custom dimension
    4. Targeting values -> This can be skipped if they will be created with a script, otherwise insert incrementing numbers, starting at 0 (e.g. 0, 1, 2, 3).
  3. Hit Save
  4. Open the ay_hash key-value and copy the numeric custom_key_id from the URL in the browsers address bar.
  5. Send us the key-value id (custom_key_id) and network code.

2. Client Adjustments

!! Important, please do not proceed with this step until all the key-values have been setup and given 30 minutes to warm up. Otherwise the reporting during that time will be broken.

  1. Make sure your client is on the latest version (see welcome page), if not, please update.
  2. Add the following two settings next to the other AY settings

For v2 with Local Storage (default setting)

window.assertive.hash = {
    generator: "server",
    values: 5000,
    key: function () {
        return [localStorage.getItem("ay_utm_s")].join("|");
// getCookie helper function
function getCookie(key) {
    var v = document.cookie.match("(^|;) ?" + key + "=([^;]*)(;|$)");
    return v ? v[2] : null;
window.assertive.hash = {
    generator: "server",
    values: 5000,
    key: function () {
        return [getCookie("ay_utm_s")].join("|");

The generator sets the hash generator to server-side for the highest accuracy and coverage possible.

The values sets the maximum amount of supported dimension values, as per prior GAM setup.

The key defines custom information that will be used for merging the data. Meaning reports will be precise above these dimensions and improves the reporting accuracy of other (not defined) dimensions as well.

The default here is set to the UTM information from the session. If you would like to change this or include more, feel free to adjust it or ask for help.

!! Important !!

The server-side hash generator is dedicating a single value for every key defined, but the limit in GAM SMB is 5000. So when the 5000 per hour, ad unit, creative size and device type is exceeded it will overlap. The server is repurposing the value that hasn't been used in the longest time. This means that high traffic values will stay dedicated while low traffic ones may overlap if the 5000 limit is exceeded.

For the highest accuracy possible it is recommended to keep the variations of the hash_key per ad unit, hour and device type below 5000.

3. Excluding part of the traffic (optional)

When this is needed

This is not needed in most cases!

This is needed only under the following conditions:

  1. You are not tracking everything with Assertive Yield
  2. Part of the untracked traffic is using the same Ad Units as the traffic tracked by AY
  3. You are using GAM with AdX and the Normalize setting is enabled.

Due to Normalize AY will take care of any discrepancies, between GAM and AY tracking. But if the untracked traffic is using the same Ad Units as the tracked traffic, AY is unable to calculate the discrepancy. This results in the normalization feature not working.

How to exclude the traffic, so it doesn't affect the normalization

  1. Navigate to Inventory -> Key-values and open the ay_hash key-value.
  2. Remove the highest value from the Predefined values list.
  3. Add a new value -2 to the Predefined values list.
  4. On pages where AY tracking is not enabled, add the following to the page:
window.googletag = window.googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(() => {
    googletag.pubads().setTargeting("ay_hash", "-2");
  1. Update the AY Tracker configuration to reflect the new highest value. For this change the existing values property under hash to the new highest value +1. E.g. if the new highest value is 4998, the values property should be set to 4999.

With this in place, all traffic that is not tracked by AY is marked as -2 in GAM and excluded by AY from the normalization.

This website uses cookies.   Learn more