Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GA Async Tag #142

Closed
ghost opened this issue Mar 22, 2017 · 2 comments
Closed

Use GA Async Tag #142

ghost opened this issue Mar 22, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 22, 2017

Move to head (more info on why below) to allow analytics script preloading in modern browsers. My tests show a ~5 point bump in PageSpeed by switching from script at the bottom of the body. I haven't tested against the current theme use of the DOM Script Tag method, but I'm confident tests will reveal an improvement if moved.

https://developers.google.com/analytics/devguides/collection/analyticsjs/

While the [the old snippet] ensures the script will be loaded and executed asynchronously on all browsers, it has the disadvantage of not allowing modern browsers to preload the script.

<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', '{{ site.analytics.google.tracking_id }}', 'auto');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>

I'd recommend placing any async scripts above any external blocking requests in the head (i.e. before the external stylesheets) for maximum benefit. Doing so will kick off the async download before the parser gets blocked waiting the external stylesheet requests.

@inetbiz
Copy link
Contributor

inetbiz commented Apr 21, 2019

@Phlow this should help!

@Phlow
Copy link
Owner

Phlow commented Jun 21, 2021

Finally added

@Phlow Phlow closed this as completed Jun 21, 2021
oscoDOTblog added a commit to oscoDOTblog/atemosta-site-v1 that referenced this issue Mar 5, 2023
* Bump kramdown from 2.1.0 to 2.3.0 (Phlow#211)

Bumps [kramdown](https://github.com/gettalong/kramdown) from 2.1.0 to 2.3.0.
- [Release notes](https://github.com/gettalong/kramdown/releases)
- [Changelog](https://github.com/gettalong/kramdown/blob/master/doc/news.page)
- [Commits](https://github.com/gettalong/kramdown/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update _06_typography.scss (Phlow#221)

* Revert Commit which destroyed the mobile navigation

* Update 2015-08-16-typography.md

Fixed an URL

* Added jekyll-theme-feeling-responsive.gemspec

* New Analytics › Moved from Footer to Head to increase speed › Use GA Async Tag

See › Phlow#142

* Update images, some text, some formatting

* No mesh together › Nav buttons at bottom of blog posts mesh together

* Bump rexml from 3.2.4 to 3.2.5 (Phlow#227)

Bumps [rexml](https://github.com/ruby/rexml) from 3.2.4 to 3.2.5.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](ruby/rexml@v3.2.4...v3.2.5)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump kramdown from 2.3.0 to 2.3.1 (Phlow#225)

Bumps [kramdown](https://github.com/gettalong/kramdown) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/gettalong/kramdown/releases)
- [Changelog](https://github.com/gettalong/kramdown/blob/master/doc/news.page)
- [Commits](https://github.com/gettalong/kramdown/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump addressable from 2.7.0 to 2.8.0 (Phlow#229)

Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/sporkmonger/addressable/releases)
- [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md)
- [Commits](sporkmonger/addressable@addressable-2.7.0...addressable-2.8.0)

---
updated-dependencies:
- dependency-name: addressable
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Broken link

* _11_syntax-highlighting.scss include data-language (Phlow#236)

Adds data-language label in top-right corner of highlight.

* Switched/Flipped Links for mobile order

* Hide the title and icon when full navigation is shown

* Update Google Analytics and correct mistyped var (Phlow#244)

Updated old Google Analytics (analytics.js) to new Global site tag (gtag.js) Google Analytics.

BTW old Google Analytics was not working here because of mistyped variable.

* Handling external links gracefully (Phlow#245)

You are setting `_baseurl` but then using `site.baseurl`.

* Typo

* fix mobile bug

---------

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mark C. Miller <miller86@llnl.gov>
Co-authored-by: Phlow <mo.phlow@gmail.com>
Co-authored-by: Denver Prophit Jr <denver.prophit@gmail.com>
Co-authored-by: litusgm <109998342+litusgm@users.noreply.github.com>
Co-authored-by: Mikael Vejdemo-Johansson <mikael@johanssons.org>
Co-authored-by: Ousikai <mtfallsVR@protonmail.com>
nick-ls pushed a commit to nick-ls/ucsd-cse15l-w22.github.io that referenced this issue Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants