ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

DoubleClick iframes raise error: `script tag for amp-analytics is likely included twice in the page` #12039

Closed AndrewGibson27 closed 7 years ago

AndrewGibson27 commented 7 years ago

What's the issue?

The error... amp-analytics is already registered. The script tag for amp-analytics is likely included twice in the page ... is shown in the browser console of AMP page that includes DoubleClick ad units. If you look at the ad iframe page source, you can see that it also includes the amp-analytics script, thus causing this error if the AMP page itself also includes that script. While this isn't causing AMP pages to invalidate, I worry it could in the future.

How do we reproduce the issue?

  1. With the browser console open, visit: https://www.texastribune.org/2017/11/13/texas-gov-greg-abbott-endorses-primary-challenger-state-rep-sarah-davi/amp/#development=1
  2. Wait for the error to appear.
  3. Here's an example of an ad iframe that includes the analytics script.

What browsers are affected?

Browser-independent issue. I got it in desktop Safari 11, latest Firefox and latest Chrome.

Which AMP version is affected?

Version 1509747505247

keithwrightbos commented 7 years ago

Hello, this is due to an AMP creative being returned by Doubleclick which does have the amp-analytics script included twice. This will be addressed in two ways going forward:

  1. We are launching Fast Fetch canonical AMP within in the next couple of weeks and your page is eligible (no usage of remote HTML or useSameDomainUntilDeprecated). This should result in a revenue and viewability increase as fast fetch separates request from render allowing it to occur immediately despite the location of the slot relative to viewport and also allows for AMP creatives to get preferential render (meaning they load without 1 second penalty and within friendly iframe re-using parent page AMP runtime). The relevant benefit of AMP creative preferential render for this issue, is that it will cause any duplicate script issues to go away.

  2. We are also separately correcting the duplicate script issue within the creative within the next 2-4 weeks.

Thanks and apologies for the confusion. For now, the duplicate script presence should have no effect on performance.