-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
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?