ampproject / ampproject/amphtml
I2I A new story analytics macro based on meta tag
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
### Summary
This proposal allows story to use in-ad meta tag for analytics purposes.
### Design Document
Given an analytics configuration like below:
```
{
"transport": {"beacon": false, "xhrpost": false},
"requests": {
"visibility": "/${type}?id=METATAG_AD_amp4ads-id"
},
"triggers": {
"rootVisible": {
"on": "story-ad-click",
"request": "storyAds",
"extraUrlParams": { … }
}
}
}
```
The following is an example of AMP4AD HTML (header only) returned as an ad response on an AMP page, which is to be rendered within an iframe.
```
body{visibility:hidden}
```
When sending out the ping upon specific events, we would replace the METATAG_AD(tagname) macro to the corresponding meta tag value inside the corresponding ads iframe.
The triggering events are
- story-ad-view
- story-ad-swipe
- story-ad-click
- story-ad-exit
The following story events are excluded, as well as other non-story events:
- story-ad-discard
- story-ad-request
- story-ad-load
- story-ad-insert
* Special scenarios
If there are multiple meta tags with the same name
- The first matching meta tag prevails
If there are no matching meta tags
- Substitute with empty string
If the macro is used outside of these specified events
- Substitute with empty string
### Motivation
Web story publishers wish to use information from within the AMPHTML story creatives to inform them of a page's performance and revenue analytics information. This proposal allows publishers to track in-creative meta tag by using a macro on the story page.
### Alternative Solutions
We have considered:
- Using the ad response headers as a means to pass information
It is not being chosen because for 3p use cases, it would be much more difficult to implement.
### Launch Tracker
_No response_
### Notifications
/cc @ampproject/wg-approvers @ampproject/wg-monetization @ampproject/wg-stories
Contributor guide
Research direction
Start with the design document in this issue and trace the four listed story-ad events in the AMP analytics implementation. Verify behavior for the first matching meta tag, missing tags, and use outside the allowed events; done when the macro resolves accordingly and the excluded events remain unsupported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- analytics, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100