Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Macro Support for FLEDGE creatives #286

Open

Description

@av-sherman

We’d like to request a feature to be supported for FLEDGE Original Trials that allows modifying the rendering URL inside the Fenced Frame. This feature request is intended to cover the period of the Origin Trials only.

Example API: deprecatedURLToURN(originalUrn, newUrl) -> newUrn

Rationale:

Macros are a common mechanism for passing runtime data to creatives for use in rendering. An example flow is where an advertiser places text (ex: "%%HEIGHT%%") in their creative and the SSP substitutes this with relevant information (ex: the ad slot height) prior to rendering the creative. Google's ads products support various macros, with one set of examples found at https://support.google.com/admanager/answer/2376981 – usages include size, ad unit, URL, GDPR, and more. There are also commonly-used macros established by industry frameworks, such as ${GDPR}, ${GDPR_CONSENT_XXXXX}, and ${US_PRIVACY}.

Macro substitution fundamentally breaks with FLEDGE – the allowed creative mutations are very limited and fenced frame rendering means that creatives render without access to the publisher’s page or information.

The navigator.deprecatedURNToURL API supported by the FLEDGE OT spec allows the retrieval of the underlying URL for the winning FLEDGE creative, which would allow applying macro substitutions to the creative URL. With the current spec, however, this modified URL could only be rendered in an IFrame and not a Fenced Frame.

We propose that the browser support a debug API that allows loading the modified rendering URL inside the Fenced Frame (and in particular invoking the same reporting API as if deprecatedURNToURL had never been called). This would be a mechanism to continue to support macro substitution during the Origin Trials, while the ads industry adjusts to a new world where macro substitution is no longer possible.

Activity

  1. jkarlin commented on Apr 21, 2022

    @jkarlin

    Hi there, thanks for filing the report!

    With the current spec, however, this modified URL could only be rendered in an IFrame and not a Fenced Frame.

    Can you point me to where this is written? We need to update that. You can actually load a plaintext url in a Fenced Frame, and put it in opaque-ads mode. Which is what I recommend that you do. e.g., first call deprecatedURNToURL to get the plaintext URL, modify it as needed, and then load it in <fencedframe mode="opaque-ads" src=your_macro_substituted_url>.

  2. jeffkaufman commented on Apr 24, 2022

    @jeffkaufman
    Contributor

    @jkarlin Sorry, you're right that "this modified URL could only be rendered in an IFrame and not a Fenced Frame" is incorrect. The motivation for this proposal, though, is the "invoking the same reporting API as if deprecatedURNToURL had never been called" bit.

    Specifically, rendering a plaintext url in a fencedframe won't allow the APIs in https://github.com/WICG/turtledove/blob/main/Fenced_Frames_Ads_Reporting.md (ex: window.fence.reportEvent), to work, because the browser will not know which FLEDGE auction they refer to.

  3. jkarlin commented on Apr 25, 2022

    @jkarlin

    Ah, I see. You lose the metadata associated with the oapque url when translating. Thanks for the clarification.

  4. JensenPaul commented on Apr 25, 2022

    @JensenPaul
    Collaborator

    This seems like a reasonable need as it enables experimentation with Fenced Frames and the reporting APIs therein as @jeffkaufman's comment mentions. This seems like something that’s permissible during the OT phase while converting URNs to URLs is already facilitated by the navigator.deprecatedURNToURL() API. Two questions:

    1. Allowing replacement of the entire URL seems overly powerful; a bidder might be unpleasantly surprised if a seller replaced their winning ad creative URL with that of another ad creative URL. What if we limited this to only macro substitutions and only when the pattern to replace either started with “${“ and ended with “}” (and didn’t contain other “{“ or “}” instances), or started and ended with “%%” (and didn’t contain other “%%” instances)? For example the API might look like: navigator.deprecatedReplaceInURN(urn, {'${X}': '1', '%%Y%%': '2'})

    2. How do you expect this to work with component ads? Perhaps it could perform the macro substitution on the component ad URLs also?

  5. av-sherman commented on Apr 26, 2022

    @av-sherman
    Author

    An API as you describe that formally supports macro substitution should work for this feature request. Also supporting these substitutions for component ads would be important as well.

    Thanks.

  6. brusshamilton commented on May 10, 2022

    @brusshamilton
    Contributor

    Do you need the API to support replacing "${"/"}" delimited sequences within URL paths (not query or fragment strings)? Supporting that case is more complicated due to how URL parsing works -- the URL parsing spec (https://url.spec.whatwg.org/#url-parsing) specifies that the '{' and '}' characters will be percent encoded inside paths but not inside query or fragment strings.

  7. av-sherman commented on May 10, 2022

    @av-sherman
    Author

    The spec for the ${GDPR_CONSENT_XXXXX} and similar macros indicates that they are used as URL parameters, though it's possible they are being used in other parts of the URL.

    Note also that macro text isn't necessarily static and can include dynamic information -- the actual replacement logic that would be most useful would be closer to a regex. E.g., something that can handle &gdpr_consent=${GDPR_CONSENT_123}, &gdpr_consent=${GDPR_CONSENT_777}, etc.

  8. brusshamilton commented on May 17, 2022

    @brusshamilton
    Contributor

    navigator.deprecatedReplaceInURN has now been implemented in Chrome 103.

  9. jeffkaufman commented on May 17, 2022

    @jeffkaufman
    Contributor
  10. gtanzer commented on Apr 20, 2023

    @gtanzer
    Contributor

    Just so you all know, as of M112 deprecatedReplaceInURN and deprecatedURNToURL also work with fenced frame configs. (The method name is the same; you pass a config in the same slot instead of a urn.)

  11. timphsieh-google commented on May 12, 2023

    @timphsieh-google

    Do you know how long will deprecatedReplaceInURN() be supported?

  12. rahulkooverjee-google commented on Aug 10, 2023

    @rahulkooverjee-google
    Contributor

    I’d like to follow up on @timphsieh's comment and ask if the Chrome team would be able to support deprecatedReplaceInURN until Fenced Frame enforcement in 2026.

    Rationale

    We believe that supporting macro substitution at 3PCD and through 2026 will help the industry better navigate the transition period, given there are a number of key advertising use cases that rely on macro substitution today, without materially impacting the privacy model.

    Use cases for macro substitution
    As @av-sherman noted, macro substitution is a common mechanism for passing data to creatives for use in rendering.

    Perhaps the most significant use case is regulatory consent requirements, where macro substitution is commonly used within industry frameworks to pass user consent information to ad tech vendors (e.g. the ${GDPR_CONSENT_XXXXX} macro). Transitioning the entire industry to a different framework will take time, which may jeopardize ecosystem readiness for cookie deprecation.

    There are other important use cases for macro substitution too - for example buyers may use information retrieved through macro substitution (such as ad size, or even contextual information) to optimize creative asset selection at render time. While there are alternative approaches that may enable this use case, it’d require that both sellers and buyers transition away from the existing, commonly used, and well optimized approach and it’s unclear what benefit that would bring (see below).

    Why we believe 2026 should be okay
    We appreciate that one of the privacy goals of the Protected Audience API and the requirement that ads render in a Fenced Frame is to prevent communication between the page and the creative. However, given that Fenced Frames will not be required until 2026, it will be the case that communication between the page and the creative is possible - for example via a postMessage() into an iFrame.

    Therefore, it seems consistent to also allow for macro substitution via deprecatedReplaceInURN until Fenced Frame rendering is required.

  13. JensenPaul commented on Aug 17, 2023

    @JensenPaul
    Collaborator

    In May 2022 Chrome added support for deprecatedReplaceInURN to address a number of different transitional issues that arose as Protected Audiences was adopted. The original ask is detailed in this issue. Macro replacement in ad creative URLs was a practice that predates Protect Audiences. The ask for this API was originally only for the duration of the Protected Audience origin trial.

    The API was also later found to help ease the transition to Protected Audience in other ways. For example, as adtechs work to adopt passing ad width and height into Protected Audience using the new ad sizes API, deprecatedReplaceInURN allowed prototyping this macro replacement before the new API was adopted, which helped avoid an extra network roundtrip.

    We’ve been thinking more about when to deprecate this feature as it facilitates user identity flowing into the ad rendering frame, which is something that Fenced Frames seeks to avoid. However it turns out that deprecatedReplaceInURN aides in Fenced Frame adoption because it can facilitate some legacy instances where it’s useful to pass contextual information into the ad rendering frame. Without these legacy instances addressed by deprecatedReplaceInURN, adtech might prefer to render ads in iframes (thus delaying Fenced Frame adoption) and pass this information in via postMessage, which Fenced Frames don’t allow. So, while iframe rendering is allowed until 2026, it makes sense to allow deprecatedReplaceInURN to be used.

    For the reasons above, we will continue to support deprecatedReplaceInURN until at least 2026.

  14. martinthomson commented on Oct 30, 2023

    @martinthomson

    Is there any intention to document this deprecatedXXX hole in the privacy story? These APIs aren't in the specification and it was not exactly obvious that the opaque URN was not effectively hiding anything from sites, given that an API to reverse the mapping exists (and will do for at least two more years).

  15. 16 remaining items

  16. michaelkleber commented on Mar 25, 2024

    @michaelkleber
    Collaborator

    Yes!

  17. timphsieh-google commented on Apr 3, 2024

    @timphsieh-google

    @michaelkleber

    I saw that the Protected Audience spec for deprecatedRenderURLReplacements seems to have a different spec than your above comment. More specifically, the example in the spec shows a potentially incorrect dictionary?:

    'deprecatedRenderURLReplacements':{{'${SELLER}':'exampleSSP'},
                                        {'%%SELLER_ALT%%':'exampleSSP'}},
    

    However, your above comment mentioned that deprecatedRenderURLReplacements should be a dictionary.

    Separately, I wasn't able to use deprecatedRenderURLReplacements to replace any macro in M125 when I passed deprecatedRenderURLReplacements to the top level auctionConfig. (I haven't tested component's auctionConfig yet.

  18. timphsieh-google commented on Apr 3, 2024

    @timphsieh-google

    To answer my own question, it looks like the Chrome feature flag --enable-features=FledgeDeprecatedRenderURLReplacements needs to be enabled to get this to work.

    In addition, it looks like deprecatedRenderURLReplacements works for a dictionary (similar to deprecatedReplaceInURN()). The spec's example is likely a typo.

  19. yonf-fel commented on May 6, 2024

    @yonf-fel

    Hi,
    we advice our partners to use the next renderUrl format - https://${seller_url}/%%seller_param%%pr1=val1...
    we found that this format is the best for replacing origin(host) and path(+query params as an option).

    can you confirm that the next format will work during support for deprecatedReplacedInURN?

  20. omriariav commented on May 15, 2024

    @omriariav

    @timphsieh-google can you please review @yonf-fel last question, please?

  21. timphsieh-google commented on May 16, 2024

    @timphsieh-google

    Yes. I also verified that the above suggestion could certainly work. However, I think there could be a sligtly better format:

    https://${video_rendering_url}?${video_component_url}https%3A%2F%2Fbuyer.com%2F%3Fvideo_ad%3D123
    

    This way we can use the same style of macros.

    @michaelkleber and @JensenPaul, I confirmed that the above would work in M126. Can you help confirm that the above URL format could continue to work?

  22. fhoering commented on May 16, 2024

    @fhoering
    Contributor

    The latest proposal seems fine to me. The only downside is that after IG creation Chrome adds an additional / before the question mark.

    After calling navigator.joinAdInterestGroup

    https://${video_rendering_url}?${video_component_url}https%3A%2F%2Fbuyer.com%2F%3Fvideo_ad%3D123
    

    becomes

    https://${video_rendering_url}/?${video_component_url}https%3A%2F%2Fbuyer.com%2F%3Fvideo_ad%3D123
    (additional / sign in the middle
    

    @michaelkleber and @JensenPaul
    Can you confirm that this will not create issues somewhere in Chrome for caching or page loading ?

  23. JensenPaul commented on May 17, 2024

    @JensenPaul
    Collaborator

    @michaelkleber and @JensenPaul, I confirmed that the above would work in M126. Can you help confirm that the above URL format could continue to work?

    @timphsieh-google, the macro replacement code hasn't been modified since it landed 9 months ago, and I don't know of any plans to modify it. So long as the URL is valid before and after replacements, I don't see a reason it would not continue to work.



    after IG creation Chrome adds an additional / before the question mark.

    @fhoering, I believe this is a byproduct of standard URL parsing. When I put new URL("https://a?").toString() in the JavaScript console of all the browsers I tried, I get "https://a/?".

    @michaelkleber and @JensenPaul
    Can you confirm that this will not create issues somewhere in Chrome for caching or page loading ?

    @fhoering, caching and page loading are done with URLs after the macro replacements are completed, so they should be unaffected by the URL's state prior to macro replacement.

  24. JensenPaul commented on May 20, 2024

    @JensenPaul
    Collaborator

    A quick update on the status of rolling out of deprecatedRenderURLReplacements: This support is enabled in 50% of Chrome Canary and Dev and Beta traffic, and 1% of Chrome Stable traffic. We hope to very soon have it enabled for 100% of Chrome traffic. Note that we’re not rolling out to labeled Chrome-facilitated testing traffic to avoid disrupting ongoing experiments and testing.

  25. omriariav commented on Jul 8, 2024

    @omriariav

    @JensenPaul Hi, what's the latest on the rollout? I tried searching for the feature status at https://chromestatus.com/features but couldn't find it. Do you have a plan to add this to a stable release?

  26. omriariav commented on Aug 1, 2024

    @omriariav

    @JensenPaul hi, following up here if you can please help me gather more visibility on when it will reach stable?

  27. dmdabbs commented on Aug 14, 2024

    @dmdabbs
    Contributor

    Hello @JensenPaul. Back in May you wrote:

    Note that we’re not rolling out (deprecatedRenderURLReplacements) to labeled Chrome-facilitated testing traffic to avoid disrupting ongoing experiments and testing.

    As I understand it, the CMA-aligned "market testing" has completed. Chrome has extended the current set of labels (evaluating possible changes to the labeling configuration), and you "expect ad-techs to continue to use the labels to evaluate and optimize deployments of the Privacy Sandbox Ads APIs." Evaluating features across all users would be helpful.

  28. dmdabbs commented on Sep 5, 2024

    @dmdabbs
    Contributor

    Hello @JensenPaul. The FledgeDeprecatedRenderURLReplacements cmdline flag no longer works in Canary. I've had this flag set for quite some time.

    Noting also that back in May you "hope to very soon have it enabled for 100% of Chrome traffic."

  29. JensenPaul commented on Oct 16, 2024

    @JensenPaul
    Collaborator

    @JensenPaul hi, following up here if you can please help me gather more visibility on when it will reach stable?

    This went to 100% of Chrome Stable population May 20th.

    Hello @JensenPaul. The FledgeDeprecatedRenderURLReplacements cmdline flag no longer works in Canary. I've had this flag set for quite some time.

    The flag was enabled by default in Canary May 17th in this CL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Non-breaking Feature RequestFeature request for functionality unlikely to break backwards compatibility

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions