question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FEATURE REQUEST: option to load the script with `defer` attribute.

See original GitHub issue

I don’t want the gtag.js to load on my site like this:

<script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-159330658-2&amp;l=dataLayer" charset="utf-8"></script>

I want it like this

<script defer src="https://www.googletagmanager.com/gtag/js?id=UA-159330658-2&amp;l=dataLayer" charset="utf-8"></script>

Here is how it impacts the site.

Please provide an option for this.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
MatteoGabrielecommented, Feb 8, 2021

🎉 This issue has been resolved in version 1.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

2reactions
MatteoGabrielecommented, Feb 8, 2021

I’ve added the deferScriptLoad boolean option in the list of plugin options

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Defer Parsing of JavaScript in WordPress (4 Methods)
Make sure to replace “defer.js” with the actual file name/path of the JavaScript file that you want to defer. Then, you can use...
Read more >
Efficiently load JavaScript with defer and async
In doing so, the script is loaded and executed after all the page is already parsed and loaded, which is a huge improvement...
Read more >
Defer Attribute (Chrome) - javascript
The purpose of defer is to tell the externally linked script to wait until the page finishes loading until it runs. The same...
Read more >
The Defer Attribute Explained
In this tutorial, you will learn about the defer attribute and how it can be used within your web pages to improve page...
Read more >
The Script element - HTML: HyperText Markup Language
Scripts with the defer attribute will prevent the DOMContentLoaded event from firing until the script has loaded and finished evaluating.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found