Skip to content

Commit

Permalink
adding the load-cookie update to the amp reference
Browse files Browse the repository at this point in the history
  • Loading branch information
bretg committed Jul 3, 2024
1 parent 53de889 commit 9ca9b22
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 58 deletions.
112 changes: 56 additions & 56 deletions dev-docs/show-prebid-ads-on-amp-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ sidebarType: 2
---

# Prebid AMP Implementation Guide

{: .no_toc}

This page has instructions for showing ads on Accelerated Mobile Pages (AMP) using Prebid.js.
Expand All @@ -15,37 +14,37 @@ Through this implementation, [Prebid Server][PBS] fetches demand and returns key

For more information about AMP RTC, see:

* [Prebid Server and AMP](/prebid-server/use-cases/pbs-amp.html)
* [Prebid Server AMP Endpoint Technical Documentation](/prebid-server/endpoints/openrtb2/pbs-endpoint-amp.html)
* [Prebid Server Stored Bid Requests](https://github.com/prebid/prebid-server/blob/master/docs/developers/stored-requests.md#stored-bidrequests)
* [AMP RTC Overview](https://github.com/ampproject/amphtml/blob/master/extensions/amp-a4a/rtc-documentation.md)
* [AMP RTC Publisher Integration Guide](https://github.com/ampproject/amphtml/blob/master/extensions/amp-a4a/rtc-publisher-implementation-guide.md)
- [Prebid Server and AMP](/prebid-server/use-cases/pbs-amp.html)
- [Prebid Server AMP Endpoint Technical Documentation](/prebid-server/endpoints/openrtb2/pbs-endpoint-amp.html)
- [Prebid Server Stored Bid Requests](https://github.com/prebid/prebid-server/blob/master/docs/developers/stored-requests.md#stored-bidrequests)
- [AMP RTC Overview](https://github.com/ampproject/amphtml/blob/master/extensions/amp-a4a/rtc-documentation.md)
- [AMP RTC Publisher Integration Guide](https://github.com/ampproject/amphtml/blob/master/extensions/amp-a4a/rtc-publisher-implementation-guide.md)

{% capture tipNote %}
For ad ops setup instructions, see [Google Ad Manager with Prebid Step by Step](/adops/step-by-step.html).
{% endcapture %}

{% include alerts/alert_note.html content=tipNote %}

* TOC
- TOC
{:toc }

## Prerequisites

To set up Prebid to serve ads into your AMP pages, you'll need:

* An account with a [Prebid Server][PBS] instance
* One or more Prebid Server Stored Bid Requests. A Stored Bid Request is a partial OpenRTB JSON request which:
* Specifies properties like currency, schain, price granularity, etc.
* Contains a list of demand partners and their respective parameters
* An AMP page containing at least one amp-ad element for an AMP ad network that supports Fast Fetch and AMP RTC
- An account with a [Prebid Server][PBS] instance
- One or more Prebid Server Stored Bid Requests. A Stored Bid Request is a partial OpenRTB JSON request which:
- Specifies properties like currency, schain, price granularity, etc.
- Contains a list of demand partners and their respective parameters
- An AMP page containing at least one amp-ad element for an AMP ad network that supports Fast Fetch and AMP RTC

## Implementation

* [Prebid Server Stored Request](#prebid-server-stored-request): This is the Prebid Server Stored Bid Request.
* [AMP content page](#amp-content-page): This is where your content lives.
* [HTML Creative](#html-creative): This is the creative your Ad Ops team puts in your ad server.
* [User Sync in AMP](#user-sync): This is the `amp-iframe` pixel that must be added to your AMP page to sync users with Prebid Server.
- [Prebid Server Stored Request](#prebid-server-stored-request): This is the Prebid Server Stored Bid Request.
- [AMP content page](#amp-content-page): This is where your content lives.
- [HTML Creative](#html-creative): This is the creative your Ad Ops team puts in your ad server.
- [User Sync in AMP](#user-sync): This is the `amp-iframe` pixel that must be added to your AMP page to sync users with Prebid Server.

### Prebid Server Stored Request

Expand All @@ -54,12 +53,12 @@ You will have to create at least one Stored Request for Prebid Server. Valid St
An example Stored Request is given below. You'll see that the Stored Request contains some important info
that doesn't come from /amp parameters:

* cur
* schain
* ext.prebid.cache.bids - needed to let Prebid Server know that you want it to store the result in PBC
* ext.prebid.targeting.pricegranularity - needed to let Prebid Server know how to calculate the price bucket
* ext.prebid.aliases
* bidders and their parameters
- cur
- schain
- ext.prebid.cache.bids - needed to let Prebid Server know that you want it to store the result in PBC
- ext.prebid.targeting.pricegranularity - needed to let Prebid Server know how to calculate the price bucket
- ext.prebid.aliases
- bidders and their parameters

```json
{
Expand Down Expand Up @@ -129,10 +128,10 @@ This script provides code libraries that will convert `<amp-ad>` properties to t

The `amp-ad` elements in the page body need to be set up as shown below, especially the following attributes:

* `data-slot`: Identifies the ad slot for the auction.
* `rtc-config`: Used to pass JSON configuration data to [Prebid Server][PBS], which handles the communication with AMP RTC.
* `vendors` is an object that defines any vendors that will be receiving RTC callouts (including Prebid Server) up to a maximum of five. The list of supported RTC vendors is maintained in [callout-vendors.js](https://github.com/ampproject/amphtml/blob/master/src/service/real-time-config/callout-vendors.js). We recommend working with your Prebid Server hosting company to set up which bidders and parameters should be involved for each AMP ad unit.
* `timeoutMillis` is an optional integer that defines the timeout in milliseconds for each individual RTC callout. The configured timeout must be greater than 0 and less than 1000ms. If omitted, the timeout value defaults to 1000ms.
- `data-slot`: Identifies the ad slot for the auction.
- `rtc-config`: Used to pass JSON configuration data to [Prebid Server][PBS], which handles the communication with AMP RTC.
- `vendors` is an object that defines any vendors that will be receiving RTC callouts (including Prebid Server) up to a maximum of five. The list of supported RTC vendors is maintained in [callout-vendors.js](https://github.com/ampproject/amphtml/blob/master/src/service/real-time-config/callout-vendors.js). We recommend working with your Prebid Server hosting company to set up which bidders and parameters should be involved for each AMP ad unit.
- `timeoutMillis` is an optional integer that defines the timeout in milliseconds for each individual RTC callout. The configured timeout must be greater than 0 and less than 1000ms. If omitted, the timeout value defaults to 1000ms.

e.g. for the AppNexus cluster of Prebid Servers:

Expand Down Expand Up @@ -222,15 +221,16 @@ Replace `MACRO` in the preceding example with the appropriate macro for the ad s

### User Sync

To sync user IDs with Prebid Server, the `amp-iframe` below may be added to your AMP pages referring to `load-cookie.html` or if you're running an IAB-compliant AMP CMP you can use `load-cookie-with-consent.html`.
To sync user IDs with Prebid Server, the `amp-iframe` below may be added to your AMP pages referring to `load-cookie.html`.

Note that AMP constrains syncing as described in the [amp-iframe](https://amp.dev/documentation/components/amp-iframe) documentation. You may only have *one* amp-iframe on your page that is small, e.g. 1x1. Many publishers already have some kind of analytics or tracking frame on their page, so they may find it difficult to manage this. Several hacks are possible, including building a 'frankenstein' script that combines all of your required tracking into one or tying the sync to an image that's large enough to be visible.
AMP constrains syncing as described in the [amp-iframe](https://amp.dev/documentation/components/amp-iframe) documentation. You may only have *one* amp-iframe on your page that is small, e.g. 1x1. Many publishers already have some kind of analytics or tracking frame on their page, so they may find it difficult to manage this. Several hacks are possible, including building a 'frankenstein' script that combines all of your required tracking into one or tying the sync to an image that's large enough to be visible.

Notes:

* The following examples include a transparent image as a placeholder which will allow you to place the example at the top within the HTML body. If this is not included the iFrame must be either 600px away from the top or not within the first 75% of the viewport when scrolled to the top – whichever is smaller. For more information on this, see [amp-iframe](https://amp.dev/documentation/components/amp-iframe/)
* Note that the `sandbox` parameter to the amp-iframe must include both "allow-scripts" and "allow-same-origin".
* The load-cookie-with-consent.html file has the same argument syntax as load-cookie.html. It's a different file because it's larger and depends on the existence of an AMP Consent Management Platform.
- The following examples include a transparent image as a placeholder which will allow you to place the example at the top within the HTML body. If this is not included the iFrame must be either 600px away from the top or not within the first 75% of the viewport when scrolled to the top – whichever is smaller. For more information on this, see [amp-iframe](https://amp.dev/documentation/components/amp-iframe/)
- The `sandbox` parameter to the amp-iframe must include both "allow-scripts" and "allow-same-origin".
- If your PBS host company is using a version of `load-cookie.html` older than July of 2024 and if your AMP page is using a CMP, you should consider using 'load-cookie-with-consent.html` instead. It's the same functionality, but older versions of `load-cookie.html` cannot read from CMPs.


Check failure on line 234 in dev-docs/show-prebid-ads-on-amp-pages.md

View workflow job for this annotation

GitHub Actions / run markdownlint

Multiple consecutive blank lines

dev-docs/show-prebid-ads-on-amp-pages.md:234 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2] https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md012.md
If you're using AppNexus' managed service, you would enter something like this:

Expand Down Expand Up @@ -268,44 +268,44 @@ Or you can specify a full URL to another Prebid Server location (including a QA
</amp-iframe>
```

See [manually initiating a sync](/prebid-server/developers/pbs-cookie-sync.html#manually-initiating-a-sync) for more information about the available parameters.
See [manually initiating a sync](/prebid-server/developers/pbs-cookie-sync.html#manually-initiating-a-sync) for more information about the available parameters and for how to host the load-cookie script.

### AMP RTC

If you're using a custom RTC callout rather than one of the pre-defined [vendor callouts](https://github.com/ampproject/amphtml/blob/main/src/service/real-time-config/callout-vendors.js), here are the parameters that can be passed through the RTC string:

* tag_id (this correspondes to the Prebid Server stored request ID)
* 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)
* attl_consent=CONSENT_METADATA(additionalConsent)
- tag_id (this correspondes to the Prebid Server stored request ID)
- 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)
- attl_consent=CONSENT_METADATA(additionalConsent)

## Debugging Tips

To review that Prebid on AMP is working properly the following aspects can be looked at:

* Include `#development=1` to the URL to review AMP specifc debug messages in the browser console.
* Look for the Prebid server call in the network panel. You can open this URL in a new tab to view additional debugging information relating to the Prebid Server Stored Bid Request. If working properly, Prebid server will display the targeting JSON for AMP to use.
* Look for the network call from the Ad Server to ensure that key values are being passed. (For Google Ad Manager these are in the `scp` query string parameter in the network request)
* Most of the debugging information is omitted from the Prebid Server response unless the `debug=1` parameter is present in the Prebid Server query string. AMP won't add this parameter, so you'll need to grab the Prebid Server URL and manually add it to see the additional information provided.
- Include `#development=1` to the URL to review AMP specifc debug messages in the browser console.
- Look for the Prebid server call in the network panel. You can open this URL in a new tab to view additional debugging information relating to the Prebid Server Stored Bid Request. If working properly, Prebid server will display the targeting JSON for AMP to use.
- Look for the network call from the Ad Server to ensure that key values are being passed. (For Google Ad Manager these are in the `scp` query string parameter in the network request)
- Most of the debugging information is omitted from the Prebid Server response unless the `debug=1` parameter is present in the Prebid Server query string. AMP won't add this parameter, so you'll need to grab the Prebid Server URL and manually add it to see the additional information provided.

## Further Reading

* [Prebid Server and AMP](/prebid-server/use-cases/pbs-amp.html)
* [Google Ad Manager with Prebid Step by Step](/adops/step-by-step.html) (Ad Ops Setup)
* [AMP RTC Overview](https://github.com/ampproject/amphtml/blob/master/extensions/amp-a4a/rtc-documentation.md)
* [callout-vendors.js]
- [Prebid Server and AMP](/prebid-server/use-cases/pbs-amp.html)
- [Google Ad Manager with Prebid Step by Step](/adops/step-by-step.html) (Ad Ops Setup)
- [AMP RTC Overview](https://github.com/ampproject/amphtml/blob/master/extensions/amp-a4a/rtc-documentation.md)
- [callout-vendors.js]

<!-- Reference Links -->

Expand Down
4 changes: 2 additions & 2 deletions prebid-server/developers/pbs-cookie-sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ This is how to control the coop syncing behavior from Prebid.js:
Where Prebid.js isn't present, like on [AMP](/prebid-server/use-cases/pbs-amp.html) pages, the call to [/cookie_sync](/endpoints/pbs-endpoint-cookieSync.html) doesn't happen automatically.
If there are scenarios where Prebid.js isn't around to initiate the /cookie_sync call, publishers can choose to put an iframe on their page.

This approach works in a way quite similar to Prebid.js except that the [/cookie_sync endpoint](/endpoints/pbs-endpoint-cookieSync.html) is initiated by a separate script that's part of `load-cookie.html'. This file must be placed on a CDN by the publisher's Prebid Server host company. Up until April 2024, the script existed in the [Prebid Universal Creative](https://github.com/prebid/prebid-universal-creative) repository, but has since been moved to the [user-sync](https://github.com/prebid/user-sync) repo.
This approach works in a way quite similar to Prebid.js except that the [/cookie_sync endpoint](/endpoints/pbs-endpoint-cookieSync.html) is initiated by a separate script that's part of `load-cookie.html'. This file must be placed on a CDN by the publisher's Prebid Server host company. Up until July 2024, the script existed in the [Prebid Universal Creative](https://github.com/prebid/prebid-universal-creative) repository, but has since been moved to the [user-sync](https://github.com/prebid/user-sync) repo.

1. The Prebid Server hosting company places the [load-cookie.html](#manually-initiating-a-sync) file onto a CDN.

Expand Down Expand Up @@ -138,7 +138,7 @@ Here are all the arguments supported:
Note that enabling or disabling [Cooperative Sync](#cooperative-syncing) is not currently supported in load-cookie. Please make sure the account default is set up appropriately in PBS config.

{: .alert.alert-warning :}
Note: if your PBS host company is using a version of `load-cookie.html` older than May of 2024 and if your AMP page is using a CMP, you should consider using 'load-cookie-with-consent.html` instead. It's the same functionality, but older versions of `load-cookie.html` cannot read from CMPs.
Note: if your PBS host company is using a version of `load-cookie.html` older than July of 2024 and if your AMP page is using a CMP, you should consider using 'load-cookie-with-consent.html` instead. It's the same functionality, but older versions of `load-cookie.html` cannot read from CMPs.

## Bidder Instructions for Building a Sync Endpoint

Expand Down

0 comments on commit 9ca9b22

Please sign in to comment.