ampproject / ampproject/amphtml

[story-ads] Support analytics triggers when an ad is served into a x-domain iframe.

Open
#37,832 2 comments 0 reactions 0 assignees View on GitHub
Stale Type: Feature Request WG: analytics WG: monetization
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

Story ads are built on top of the AMPHTML Ads format. Usually this means they are rendered into a friendly iframe in web stories. However there are cases where these creatives are rendered into x-domain iframes, and ad networks may decide to start using x-domain at any time.

When an ad is served into a x-domain iframe analytics triggers on the parent page will not fire. We could find a way to postmessage these events from the creative to the parent page using the inabox library. The parent page could listen for the messages and fire the events appropriately.

Potential issues
- If an ad network has decided to serve a creative x-domain they may not want us to leak data to the publishers. These are policy questions that are very tricky to work out
- When you open the world to x-domain iframes sometimes you will start getting things like nested iframes where it would be difficult to ensure these events are propagated.

@ampproject/wg-stories

### Alternatives Considered

Don't support this.

### Additional Context

https://github.com/ampproject/amphtml/issues/37831

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the inabox library and the additional context in issue 37831. The issue does not name files or tests, and work is not ready to implement until the cross-domain data-sharing policy and nested-iframe propagation behavior are decided; done would need to be defined after those decisions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
analytics, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.