Website Optimization Measures, Part VI

Published on March 10, 2009 (ā†» February 5, 2024), filed under (RSS feed for allĀ categories).

This and many other posts are also available as a pretty, well-behaved ebook: On Web Development. And speaking of which, hereā€™s a short treatise just about managing the quality of websites: The Little Book of Website Quality Control (updated).

This post is partially outdated.

Does this article series still need an introduction? I donā€™t know, but Iā€™m willing to take a risk.

This is a part of an open article series. Check out some of the other posts!

Was this useful or interesting? Share (toot) this post, or maybe treat me to a coffee.Ā Thanks!

About Me

Jens Oliver Meiert, on September 30, 2021.

Iā€™m Jens, and Iā€™m an engineering lead and author. Iā€™ve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, Iā€™m close to W3C and WHATWG, and I write and review books for Oā€™Reilly and FrontendĀ Dogma.

With my current move to Spain, Iā€™m open to a new remote frontend leadership position. Feel free to review and refer my CV or LinkedInĀ profile.

I love trying things, not only in web development, but also in other areas like philosophy. Here on meiert.com I share some of my views andĀ experiences.

Comments (Closed)

  1. On March 12, 2009, 9:56 CET, Francesco said:

    First of all, thanks for this really interesting article!

    If the Google Analytics code you mentioned is really the only JavaScript code I use on my website, would it be more correct to create an external script and include it into the HTML code or directly include the JavaScript code? Because including it directly would save a HTTP request, right?

  2. On March 13, 2009, 17:17 CET, Amber Kimball said:

    This explains a lot to a ā€œnewbieā€ such as myself, so much to learn with so little time, your guidance is valuable, thanks so much and Iā€™ll be back to learn more as I move along.
    Best Wishes,
    Amber Kimball

  3. On March 15, 2009, 16:28 CET, Jens Oliver Meiert said:

    Francesco, thatā€™s right. However, that scenario would ask you to balance performance and maintainability. Just one instead of two script files would be faster; the Analytics configuration in a script file versus having it in each HTML template or doc would be more maintainable.

    Amber, youā€™re very welcome.

  4. On March 17, 2009, 0:04 CET, Francesco said:

    What exactly is this useful for?

    if (_gat && _gat._getTracker) {
    try {
    ā€¦

    I mean I see that it checks if _gat and _gat._getTracker is true but why would I like to do this? Why not only use this code for my initAnalytics function and nothing else?

    var pageTracker = _gat._getTracker(ā€UA-XXXXXX-Xā€);
    pageTracker._initData();
    pageTracker._trackPageview();

  5. On March 17, 2009, 10:56 CET, Kroc Camen said:

    I would go as far as saying - dump just about everything from the header. Most sites clutter the crap out of the head.

    - Donā€™t use a favicon link. /favicon.ico is assumed by all browsers automatically.

    - Donā€™t use keywords/description. Google works. I donā€™t have any meta keywords/description and it has not inhibited indexing, not people finding my site one iota.

    - Donā€™t use Content-type. Set your server to automatically add a UTF-8 header.

    Check my siteā€™s head element out. Three lines. Title, stylesheet, RSS and thatā€™s it. All you need.

  6. On March 17, 2009, 16:59 CET, Jens Oliver Meiert said:

    Francesco, that if statement just makes sure that the Google Analytics script is present (by looking for the _gat object)ā€¦ or did I misunderstand?

    Kroc, easy šŸ˜‰ Interesting thought regarding the faviconā€¦ admittedly, I still reference it due to IE problems in the past, though itā€™s long that I last tested how IE behaves here. Concerning the encoding, well, the advantage of having it specified within the file is that you donā€™t run into any issues when accessing the file outside server context (e.g. locally, or when stored on any data carrier). Must not but might influence the technical approach.

  7. On March 19, 2009, 22:11 CET, Francesco said:

    Are there any drawbacks hosting the ga.js file locally?

  8. On April 1, 2009, 22:53 CEST, Jonas said:

    @ Francesco: Probably not, if you have a mechanism to keep it up-to-date (cronjob or simmilar).

  9. On April 1, 2009, 23:01 CEST, Jonas said:

    Oh, and checking for the Google Analytics functions to be present before calling them is good practice, since some people block certain scripts for privacy reasons. So they donā€™t get a javascript error. Iā€™m not sure why Google doesnā€™t have that check in their code examples/recommendations.

  10. On May 10, 2009, 17:07 CEST, Rick Daley said:

    You have a very nice website that is very informative on website optimization .
    And I also agree about what you said about Making Google Analytics code more maintainable
    Thanks for the info.
    Rick

  11. On May 25, 2009, 13:53 CEST, Alan Buchanan said:

    Thanks alot for some of the great ideas ive found in this series of articles. Its some pretty basic things i would never have thought of.
    Heyā€¦ Its all part of the learning curve eh?

    Thanks alot Jens.

  12. On August 4, 2009, 14:36 CEST, Markus said:

    Would you rather recommend to host the ga.js file locally or to include it from Google Analytics directly?