Appearance
AMP Integration
Overview
Missena supports integration with AMP (Accelerated Mobile Pages) through Prebid Server and AMP's Real-Time Config (RTC) mechanism.
Since AMP restricts custom JavaScript, traditional client-side header bidding is not possible. Instead, the auction happens server-side via Prebid Server (prebid.missena.io), and targeting keys are passed to your ad server (e.g. Google Ad Manager) automatically.
How it works
- AMP loads the
<amp-ad>component - AMP calls Prebid Server's
/openrtb2/ampendpoint via thertc-configattribute - Prebid Server resolves the stored request for your
tag_id, runs the auction with Missena - Prebid Server returns targeting keys (
hb_pb,hb_bidder,hb_cache_id, etc.) - AMP applies the targeting to the ad server request
- GAM line items match on targeting and serve the Prebid creative if it wins
Tag ID Format
The tag_id used in the RTC URL identifies your stored request on Prebid Server. It follows this format:
PA-XXXXXXXX-{placement}-{sample}| Part | Description | Examples |
|---|---|---|
PA-XXXXXXXX | Your Missena API key | PA-34745704 |
{placement} | Ad placement type | footer, infeed |
{sample} | Creative sample type | native, banner |
For example: PA-34745704-footer-native or PA-34745704-infeed-banner.
The sample part is optional — you can also use PA-XXXXXXXX-{placement} only (e.g. PA-34745704-footer).
Contact Missena support to get your tag ID configured on Prebid Server.
Prerequisites
Before starting, make sure you have:
- Your Missena tag ID (e.g.
PA-34745704-footer-native) - A Google Ad Manager (GAM) ad unit configured with Prebid line items
- A stored request configured on Prebid Server for your tag ID — contact Missena support to set this up
Integration Steps
1. Include AMP Scripts
Add the required AMP ad script in your <head>:
html
<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>2. Add the Ad Tag
Place the <amp-ad> tag in your page with the rtc-config attribute pointing to Missena's Prebid Server:
html
<amp-ad
width="300"
height="250"
type="doubleclick"
data-slot="/YOUR-NETWORK-ID/YOUR-AD-UNIT"
rtc-config='{
"urls": [
"https://prebid.missena.io/openrtb2/amp?tag_id=PA-XXXXXXXX-footer-native&w=ATTR(width)&h=ATTR(height)&ow=ATTR(data-override-width)&oh=ATTR(data-override-height)&ms=ATTR(data-multi-size)&slot=ATTR(data-slot)&targeting=TGT&curl=CANONICAL_URL&timeout=TIMEOUT&adc=ADCID&purl=HREF&gdpr_consent=CONSENT_STRING&consent_type=CONSENT_METADATA(consentStringType)&gdpr_applies=CONSENT_METADATA(gdprApplies)"
],
"timeoutMillis": 1000
}'>
</amp-ad>Note
Replace PA-XXXXXXXX-footer-native with your Missena tag ID (see Tag ID Format above) and /YOUR-NETWORK-ID/YOUR-AD-UNIT with your GAM ad unit path.
3. Using with infeed
To display Missena as an in-feed ad within your content, place the <amp-ad> tag where you want the ad to appear and use an infeed tag ID:
html
<amp-ad
width="300"
height="250"
type="doubleclick"
data-slot="/YOUR-NETWORK-ID/YOUR-AD-UNIT"
rtc-config='{
"urls": [
"https://prebid.missena.io/openrtb2/amp?tag_id=PA-XXXXXXXX-infeed&w=ATTR(width)&h=ATTR(height)&ow=ATTR(data-override-width)&oh=ATTR(data-override-height)&ms=ATTR(data-multi-size)&slot=ATTR(data-slot)&targeting=TGT&curl=CANONICAL_URL&timeout=TIMEOUT&adc=ADCID&purl=HREF&gdpr_consent=CONSENT_STRING&consent_type=CONSENT_METADATA(consentStringType)&gdpr_applies=CONSENT_METADATA(gdprApplies)"
],
"timeoutMillis": 1000
}'>
</amp-ad>RTC Parameters Reference
The rtc-config URL uses AMP macros that are automatically resolved at runtime:
| Macro | Description |
|---|---|
ATTR(width) / ATTR(height) | Ad slot dimensions |
ATTR(data-override-width) / ATTR(data-override-height) | Override dimensions if set |
ATTR(data-multi-size) | Multi-size ad request |
ATTR(data-slot) | GAM ad unit path |
TGT | Existing targeting key-values |
CANONICAL_URL | Page canonical URL |
TIMEOUT | RTC timeout value |
ADCID | AMP Client ID |
HREF | Current page URL |
CONSENT_STRING | User's consent string (TCF) |
CONSENT_METADATA(consentStringType) | Consent string type |
CONSENT_METADATA(gdprApplies) | Whether GDPR applies |
Full Page Example
html
<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<title>My AMP Page</title>
<link rel="canonical" href="https://example.com/my-page" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<!-- AMP scripts -->
<script async custom-element="amp-ad"
src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
<!-- AMP boilerplate -->
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style>
<noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
<h1>My Article</h1>
<p>Article content goes here...</p>
<!-- Missena ad via Prebid Server -->
<amp-ad
width="300"
height="250"
type="doubleclick"
data-slot="/YOUR-NETWORK-ID/YOUR-AD-UNIT"
rtc-config='{
"urls": [
"https://prebid.missena.io/openrtb2/amp?tag_id=PA-XXXXXXXX-footer-native&w=ATTR(width)&h=ATTR(height)&ow=ATTR(data-override-width)&oh=ATTR(data-override-height)&ms=ATTR(data-multi-size)&slot=ATTR(data-slot)&targeting=TGT&curl=CANONICAL_URL&timeout=TIMEOUT&adc=ADCID&purl=HREF&gdpr_consent=CONSENT_STRING&consent_type=CONSENT_METADATA(consentStringType)&gdpr_applies=CONSENT_METADATA(gdprApplies)"
],
"timeoutMillis": 1000
}'>
</amp-ad>
</body>
</html>Using Your Own Prebid Server
If you run your own Prebid Server instance, you can configure stored requests yourself instead of relying on prebid.missena.io.
How Stored Requests Work with AMP
Since AMP pages cannot execute custom JavaScript, the entire auction configuration is defined server-side as a stored request. When AMP calls the /openrtb2/amp endpoint with a tag_id, Prebid Server looks up the corresponding stored request JSON, runs the auction, and returns targeting keys.
The flow is:
- You create a stored request JSON file on your Prebid Server
- The AMP page references it via
tag_idin thertc-configURL - Prebid Server resolves the stored request, runs the Missena auction
- Targeting keys (
hb_pb,hb_bidder,hb_cache_id, etc.) are returned to AMP - AMP passes the targeting to your ad server (e.g. GAM)
Creating a Stored Request
Each stored request is a JSON file following the OpenRTB 2.5 format. It must contain exactly one imp element.
Here is a full example for a footer placement with a native sample:
json
{
"id": "PA-34745704",
"site": {
"page": "https://publisher.com"
},
"ext": {
"prebid": {
"targeting": {
"includewinners": true,
"includebidderkeys": true,
"pricegranularity": {
"precision": 2,
"ranges": [
{
"max": 20.00,
"increment": 0.10
}
]
}
},
"cache": {
"bids": {}
}
}
},
"imp": [
{
"id": "msna-banner",
"banner": {
"format": [
{
"w": 300,
"h": 250
}
]
},
"ext": {
"prebid": {
"bidder": {
"missena": {
"apiKey": "PA-34745704",
"placement": "footer",
"sample": "native"
}
}
}
}
}
]
}TIP
The site.page value is overridden at runtime by the AMP curl (canonical URL) parameter, so you can set it to a default value.
Stored Request Fields
| Field | Description |
|---|---|
id | A unique identifier for the stored request |
ext.prebid.targeting | Controls how targeting keys are generated. includewinners and includebidderkeys should be true for GAM |
ext.prebid.targeting.pricegranularity | Defines price bucket granularity — must match your GAM line item setup |
ext.prebid.cache.bids | Enables bid caching, required for AMP creatives to render |
imp[0].banner.format | The ad sizes to request. AMP can override this via w, h, and ms query parameters |
imp[0].ext.prebid.bidder.missena | Missena bid adapter parameters (see Bid Parameters below) |
Bid Parameters
| Name | Scope | Description | Example | Type |
|---|---|---|---|---|
apiKey | required | Your Missena publisher token | "PA-34745704" | string |
placement | required | Placement type | "footer" | string |
sample | optional | Creative sample type | "native" | string |
Available placement values: sticky, header, footer, infeed, prestitial, postitial, infeed.s
Available sample values: native, banner (when omitted, defaults to native)
More Examples
Infeed with banner sample:
json
{
"imp": [
{
"id": "msna-banner",
"banner": {
"format": [{ "w": 300, "h": 250 }]
},
"ext": {
"prebid": {
"bidder": {
"missena": {
"apiKey": "PA-34745704",
"placement": "infeed",
"sample": "banner"
}
}
}
}
}
]
}Sticky placement (no sample specified):
json
{
"imp": [
{
"id": "msna-banner",
"banner": {
"format": [{ "w": 300, "h": 250 }]
},
"ext": {
"prebid": {
"bidder": {
"missena": {
"apiKey": "PA-34761163",
"placement": "sticky"
}
}
}
}
}
]
}INFO
These examples show only the imp array for brevity. Your full stored request must also include the id, site, and ext fields as shown in the full example above.
Storing the Request
How you store the request depends on your Prebid Server setup:
- File-based storage: Save the JSON file at the path configured in your Prebid Server's
settings.filesystem.directorypathunderstored_requests/data/by_id/stored_requests/<tag_id>.json - Database storage: Insert the JSON into the table configured in your Prebid Server's database settings, keyed by the
tag_id - HTTP storage: Serve the JSON from the endpoint configured in your Prebid Server's HTTP fetcher settings
The file name (without .json) or database key becomes the tag_id you reference in the AMP rtc-config URL. For example, a file named PA-34745704-footer-native.json is referenced as tag_id=PA-34745704-footer-native.
Updating the AMP Tag
When using your own Prebid Server, update the rtc-config URL to point to your server instead of prebid.missena.io:
html
<amp-ad
width="300"
height="250"
type="doubleclick"
data-slot="/YOUR-NETWORK-ID/YOUR-AD-UNIT"
rtc-config='{
"urls": [
"https://your-prebid-server.example.com/openrtb2/amp?tag_id=PA-XXXXXXXX-footer-native&w=ATTR(width)&h=ATTR(height)&ow=ATTR(data-override-width)&oh=ATTR(data-override-height)&ms=ATTR(data-multi-size)&slot=ATTR(data-slot)&targeting=TGT&curl=CANONICAL_URL&timeout=TIMEOUT&adc=ADCID&purl=HREF&gdpr_consent=CONSENT_STRING&consent_type=CONSENT_METADATA(consentStringType)&gdpr_applies=CONSENT_METADATA(gdprApplies)"
],
"timeoutMillis": 1000
}'>
</amp-ad>User Sync
For optimal match rates, add a user-sync iframe to your AMP pages. This allows Prebid Server to sync user IDs with demand partners:
html
<amp-iframe
width="1"
height="1"
sandbox="allow-scripts allow-same-origin"
title="User Sync"
style="position:absolute"
frameborder="0"
src="https://your-prebid-server.example.com/load-cookie.html?endpoint=your-endpoint&max_sync_count=5">
</amp-iframe>Testing
You can test the Prebid Server endpoint directly using curl:
bash
# Using Missena's hosted Prebid Server
curl 'https://prebid.missena.io/openrtb2/amp?tag_id=PA-XXXXXXXX-footer-native&w=300&h=250'
# Using your own Prebid Server
curl 'https://your-prebid-server.example.com/openrtb2/amp?tag_id=PA-XXXXXXXX-footer-native&w=300&h=250'Verify that the response includes targeting keys like hb_pb, hb_bidder, and hb_cache_id.
To enable debug output, add &debug=1 to the URL:
bash
curl 'https://prebid.missena.io/openrtb2/amp?tag_id=PA-XXXXXXXX-footer-native&w=300&h=250&debug=1'On your AMP page, you can also append #development=1 to the URL to see AMP console messages in the browser developer tools.
Support
For help setting up your stored request on Prebid Server or configuring GAM line items, contact your Missena account manager.