Google AMP integration

This chapter explains the setup of the Adhese ad tags in your AMP pages.

For more information about Google's Accelerated Mobile Pages project, please go to https://www.ampproject.org.

Restrictions

There are a couple of restrictions you should take into account before implementing AMP:

  • Impressions are counted by using track requests, not by using logs.
  • Separate formats and templates are necessary. You have to create separate bookings to run on AMP pages.
  • The all-together and exclusive options are not available.
  • Live previews are not available.
  • For now, you can use only image creatives.

AMP Ad Documentation

Adhese ad tag example

The tag consists of nine parameters, of which eight are required.

<amp-ad width=300 height=250
    type="adhese"
    data-location="_sdk_amp_"
    data-position=""
    data-format="amprectangle"
    data-account="demo"
    data-request-type="ad"
    json='{"targeting":{"br": ["sport", "info"],"dt": ["desktop"]}}'>
</amp-ad>

Required parameters:

ParameterDescriptionEmpty?
width

The width of the ad format as defined in Adhese.

no
heightThe height of the ad format as defined in Adhese.no
typeWill always have the value "adhese".no
data-locationThe location code as defined in Adhese.no
data-positionThe position code as defined in Adhese.yes
data-formatThe format code as defined in Adhese.no
data-accountIn most cases, this will match your Adhese account name. Contact Support.no
data-request-typeContact Support to know the value of this parameter.no

Optional parameter:

ParameterDescription
JSON

Similar to a 'regular' Adhese implementation, you can add extra target parameters to the request.

Using this JSON parameter, you have to start with a 'targeting' property, as shown in the example.

The 'targeting' property itself consists of the target prefixes (which are configured in your Adhese account) with as value an array of 1 or more targets.

{
	"targeting": {
		"br": ["sport", "info"],
		"dt": ["desktop"]
	}
}

Requirements

Position template

To let the AMP page know an ad is available, a custom event called "adhLoaded" is used.

This event should contain an object 'detail', which in turn includes three parameters and should be bound to the div with ID "c".

  • isReady: always equals 1, except if we are sending back an empty fallback ad
  • width: the width of the format, use this parameter by determining <ADHESE_WIDTH>
  • height: the height of the format, use this parameter by determining <ADHESE_HEIGHT>


var a = new CustomEvent("adhLoaded",{
detail: {
isReady: ready,
width:<ADHESE_WIDTH>,
height:<ADHESE_HEIGHT>
}
});
var amp_container = document.querySelector("#c");
amp_container.dispatchEvent(a);

Fallback

A fallback campaign is required to inform AMP no ad is available. This way, they can alter the iframe dimensions so the container won't be visible.