ampproject / ampproject/amphtml

AMP-ad: is there a way to format values in a real-time-config URL?

Open
#37,818 5 comments 0 reactions 0 assignees View on GitHub
Component: amp-ad WG: monetization
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

I'm working on passing along consent values to both an amp-ad component and an amp-analytics. With amp-analytics, I'm able to do some formatting of values before I include them as query string parameters in a URL. Specifically, I'm looking to send the consent metadata gdprApplies boolean as a 0 or 1. The way I'm doing that is something like:
`gdpr=$IF($EQUALS(CONSENT_METADATA(gdprApplies), true), 1)$IF($EQUALS(CONSENT_METADATA(gdprApplies), false), 0)`

In the amp-ad component, I'd like to do the same thing. Is it possible? I have a vendor config object in real-time-config/callout-vendors.js , and I'd like to add something equivalent to what I have above for the amp-analytics component.

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start with real-time-config/callout-vendors.js and trace how consent metadata is incorporated into amp-ad URL parameters. Compare that path with the amp-analytics formatting described in the issue, then determine the project-supported way to emit gdprApplies as 0 or 1; done means the vendor configuration can produce the requested formatted value.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.