amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

PPID parameter missing in ad requests with multiple <amp-ad> slots (works with only one)

Open dariodp89 opened this issue 4 months ago • 8 comments

Description

In an AMP page using with Real-Time Config (RTC) and for dynamic targeting, the PPID (Publisher Provided Identifier) is correctly included in the ad request to securepubads.g.doubleclick.net when only one slot is present. However, when multiple slots are added, the PPID is omitted from the ad request and is not in the payload. This issue occurs despite the PPID being dynamically set via an function (permutiveCachedTargeting.ct) that returns a ppid value alongside targeting data.

Expected Behavior:

The PPID, dynamically provided by the function in the RTC configuration, should be included in the ad request for all slots, regardless of the number of slots, as per the AMP DoubleClick documentation (amp-ad#attributes and doubleclick-rtc.md).

Actual Behavior:

The PPID is included in the ad request only when a single slot is present. With multiple slots, the PPID is omitted from the request to securepubads.g.doubleclick.net, while other targeting parameters (e.g., permutive and puid) are correctly included.

Reproduction Steps

  1. Set up an AMP page with and to provide dynamic targeting, including PPID, using Permutive data stored in localStorage (see sample code below).
  2. Add a single component with type="doubleclick", configured with RTC to call the function permutiveCachedTargeting.ct, which returns {targeting: {...}, ppid: "..."}.
  3. Validate the page with the AMP validator and load it in a browser.
  4. Inspect the ad request in the browser's DevTools (Network tab, filter for securepubads.g.doubleclick.net). Confirm that the PPID is included in the request (e.g., ppid=permutive-id-value).
  5. Add a second slot with a similar RTC configuration.
  6. Reload the page and inspect the ad request. The PPID parameter is missing from the request payload for all slots.

Sample code:

<!doctype html>
<html ⚡>
<head>
  <meta charset="utf-8">
  <script async src="https://cdn.ampproject.org/v0.js"></script>
  <script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
  <script async custom-element="amp-script" src="https://cdn.ampproject.org/v0/amp-script-0.1.js"></script>
  <script async custom-element="amp-state" src="https://cdn.ampproject.org/v0/amp-state-0.1.js"></script>
  <link rel="canonical" href="...">
  <meta name="viewport" content="width=device-width">
</head>
<body>
  <!-- Permutive configuration -->
  <amp-state id="permutiveConfig">
    <script type="application/json">
      {
        "apiKey": "[MY_API_KEY]",
        "projectId": "[MY_PROJECT_ID]",
        "environment": "production"
      }
    </script>
  </amp-state>
  <amp-script id="permutiveCachedTargeting" sandboxed script="permutiveCachedTargetingScript"></amp-script>
  <script id="permutiveCachedTargetingScript" type="text/plain" target="amp-script">
    exportFunction('ct', () => {
      let c = JSON.parse(localStorage.getItem('_pdfps'));
      let i = localStorage.getItem('permutive-id');
      return {targeting: {permutive: c ? c : [], puid: i}, ppid: i};
    })
  </script>

  <!-- First ad slot (PPID included with single slot) -->
  <amp-ad data-block-on-consent
          data-slot="[...]/TopLeft"
          width="..."
          height="..."
          data-multi-size="[MY_SIZES]"
          data-multi-size-validation="false"
          type="doubleclick"
          rtc-config='{"urls": ["amp-script:permutiveCachedTargeting.ct"], "timeoutMillis": 1000, "vendors": {...}}'
          json='{"targeting": {...}}'>
    ...
  </amp-ad>

  <!-- Second ad slot (PPID missing when added) -->
  <amp-ad data-block-on-consent
          data-slot="[...]/Frame1"
          width="..."
          height="..."
          data-multi-size="[MY_SIZES]"
          data-multi-size-validation="false"
          type="doubleclick"
          rtc-config='{"urls": ["amp-script:permutiveCachedTargeting.ct"], "timeoutMillis": 1000, "vendors": {...}}'
          json='{"targeting": {...}}'>
    ...
  </amp-ad>
</body>
</html>

Relevant Logs


Browser(s) Affected

No response

OS(s) Affected

No response

Device(s) Affected

No response

AMP Version Affected

2509191850000

dariodp89 avatar Oct 16 '25 13:10 dariodp89

@powerivq can you take a look at this

erwinmombay avatar Oct 16 '25 17:10 erwinmombay

@zombifier Given that this is about Doubleclicke extension, what do you think about this?

powerivq avatar Oct 16 '25 17:10 powerivq

I can investigate, but if there's a real testing page I can look at it'd be appreciated.

zombifier avatar Oct 16 '25 18:10 zombifier

I cannot reproduce with the test setup running locally, and with the script changed to the following: let i = ["TESTPPID"]; let c = "CONFIG";

Both slots have TESTPPID set as the PPID, so I think this rules out problems with the amp-ad doubleclick extensions or the amp-script component. It's possible this is a problem with the Permutive setup, but I'm not familiar with that. As mentioned if there is a live page I can debug on it'd be very useful.

zombifier avatar Oct 16 '25 20:10 zombifier

Hi all, thank you for the first efforts. You can see the issue here: https://www.corriere.it/cronache/25_ottobre_08/garlasco-venditti-riesame-frasi-lovati-sempio-gioco-55a40d8c-d873-4db4-a4c7-6a783706axlk_amp.shtml

Currently there are 5 ad slots so the ppid is not in the payload of the ad request, but if you remove all ad slots except one (by overriding the source code) you can see the ppid in the payload.

dariodp89 avatar Oct 20 '25 08:10 dariodp89

It seems like the cause is that the ad requests are sent in Single Request Architecture mode, which does not support RTC callouts at this time (documentation link). If I disable SRA on the page then I see five ad requests, each with the PPID parameter set.

zombifier avatar Oct 20 '25 17:10 zombifier

Thank you for the response. I see... I've tested it and it works with the separated requests. I don't know if it's acceptable for us but I'll check. Is there any chance in the (near) future that RTC calluts will be supported with Single Request Architecture mode?

dariodp89 avatar Oct 21 '25 09:10 dariodp89

For now it's not part of our roadmap. We can include it in our planning/prioritization and get back to you if it's planned.

zombifier avatar Oct 24 '25 19:10 zombifier