-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
What's the issue?
When trying to implement analytics for amp-skimlinks using the customeventreporter-api (see #17907) the amp-analytics extension is not automatically loaded on the page.
@lannka mentioned in the comments of amp-skimlinks design doc: And it's a mis-conception that pub needs to put amp-analytics extension on the page. In fact, it will be automatically inserted if there isn't one one the page.
I would therefore expect amp-analytics extension to be automatically loaded in the page if not already present.
How do we reproduce the issue?
In a simple amp page without the amp-analytics javascript, send a tracking request from an amp extension using the CustomEventReporter API as described here
When the CustomEventReporterBuilder.build function is called an Assertion failed error is showing in the console and the request is never sent.
Note: After trying to debug I noticed that the CustomEventReporter constructor function calls
insertAnalyticsElement(...) with a third argument ("loadAnalytics") set to false. Setting this 3rd argument to true fixes the issue. Any reason why "loadAnalytics" is forced to false in the context of the CustomEventReporter API?
What browsers are affected?
All
Which AMP version is affected?
Not sure, probably all.