amphtml: I2I [amp-analytics]: Custom event trigger for 3p extensions
This is for 3Ps (A4A networks, video players and others like facebook, twitter etc) to track how their AMP extensions perform, so that they can tune their products, detect and respond to issues, etc.
For that purpose, A4A has created a temporary solution for performance reporting. Meantime, more similar requirements are coming: #6306.
For sake of performance, it will be good to leverage the existing amp-analytics
infrastructure to manage those pings altogether with other ones.
Note that in normal use cases, the data collected by amp-analytics
is consumed by the publishers. The new proposed use case here are for 3Ps. So we’d be careful and prevent any sensitive data being accessed by 3P. On other hand, we already have use cases, such as A4A ActiveView tracking, of which the data are consumed not by publisher, but by 3Ps (advertisers).
Vendor config All 3Ps want to enable this feature need to write their own analytics vendor config, like what we have in vendor.js. The scope of the config should be restricted to the extension only. So that extensions cannot interfere each other.
some3p: {
"requests": {
"event": "https://3p.com/event?eventName=${event}&eventAttributes=${attributes}"
},
"triggers": {
"CustomEvent": {
"on": "custom-event",
"request": "event",
},
}
}
Usage 3P will report a custom event like this:
customEventTrackerFor(doc, 'some3p').then(tracker => {
tracker.trackEvent('event-name', { attr1: 'value1', attr2: 'value2' });
};
Limitation
- No pings for pages that don’t have
amp-analytics
installed. - The pings are asynchronous, which might introduce inaccuracy to latency calculation.
Alternative 3P can do ad-hoc pings like
new Image().src = $URL
@avimehta @cramforce @dvoytenko @rudygalfi @ericlindley-g @tdrl @keithwrightbos @jasti thoughts?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 19 (17 by maintainers)
I can’t help but thinking that somehow this can be related to #6234: leverage amp-analytics to be able to send custom events from a IFRAMEs, like video players. Makes sense?
I’d like to consider here AMP Shadow too. It would be super useful to have a standard way to to communicate from the shell to AMP in order to send analytics events, other than manually accessing the instrumentation service (our current approach)
I believe that it’s possible to have a common solution (event based?) to cover all 3 cases
What do you think?