Add option to write script code to file (rather than inline)

Created on 9 September 2020, over 4 years ago
Updated 24 March 2023, over 1 year ago

Problem/Motivation

This module puts the Google Analytics script on the page inline. When implementing CSP (Content Security Policy), inline script can be tricky. There are ways to allow it, for example, by putting a hash of the script into the script-src configuration, which is will work great for a single site. But if you have lots and lots of sites, and you just want to say the script from Google Analytics is to be trusted, the easiest way to do that is to put the code in a file.

Proposed resolution

Add an option to write the Google Analytics script to a file rather than putting it on the page inline.

Remaining tasks

  1. Get some review on the approach
  2. Use this approach for everywhere the module uses inline Javascript
  3. Review
  4. Commit!

User interface changes

Will add a checkbox to the admin settings form.

API changes

None.

Data model changes

Will add a Drupal variable.

✨ Feature request
Status

RTBC

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States dsnopek USA

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024