Publisher Ads Audits for Lighthouse suggests to load gpt.js statically

Created on 7 June 2024, 18 days ago

Problem/Motivation

Publisher Ads Audits for Lighthouse suggests to load gpt.js statically, instead of using JS to construct the script tag.

Steps to reproduce

  1. Go to simplytest.me, look for the DFP module, create a site with it. Login as admin/admin
  2. In the new site, configure a random Network ID (/admin/structure/dfp/settings).
  3. Create a DFP tag (/admin/structure/dfp/tags), just setting Ad Slot Name and Size(s) will do.
  4. Place the DFP tag block (/admin/structure/block) in any region. Use default visibility.
  5. Load the homepage, check the HTML source and verify it includes gpt.js in a JS snippet.
  6. Run the audit: in https://developers.google.com/publisher-ads-audits/ paste the simplytest.me site URL.
  7. Check the report: notice the entry to "Load ad scripts statically".

Proposed resolution

Update ./templates/dfp-js-head-top.html.twig, replace the JS snippet for gpt.js with rendering HTML directly (with proper variable usage). Using a protocol-relative URL should do for proper http/https switching?

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡΄Colombia jedihe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024