Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3676258
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:04:40+00:00 2026-05-19T03:04:40+00:00

I’ve read in many sources that Google’s recommended way to add GA code (

  • 0

I’ve read in many sources that Google’s recommended way to add GA code (link) can slow down page loading. StackOverflow itself does not place it at the header (as Google recommends) but at the bottom of the page.

So should I go with Google, StackOverflow—or should I use jQuery’s getScript?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:04:41+00:00Added an answer on May 19, 2026 at 3:04 am

    Google Analytics recommends placing the asynchronous snippet just before the </head> tag.

    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-XXXXX-X']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    </script>
    

    In the days before the asynchronous syntax, the recommendation was to put it before the closing </body> tag, to prevent page load blocking. This is no longer a serious concern.

    The only things this script will do in a blocking way is it will create a simple JavaScript array, insert some basic values, and then execute an anonymous function. The browser will move on and continue to load, while in the background the browser will request ga.js from Google servers, and then execute a __utm.gif request to Google’s servers with the tracking information.

    Because this script is inserted in a non-blocking, asynchronous way, it doesn’t prevent your content from loading on time. Placing it this early will allow you to track a larger percentage of people, including those who click away when only part of the body is loaded. Further, it reduces the possibility for error if you have event-driven tracking within your page.

    Also, because Google Analytics is nearly always served from one of two URLs (Google’s HTTP and HTTPS versions), the file is likely cached on basically any browser your users have, meaning that the script itself won’t have to be transferred.

    Simply put, best results are guaranteed if you put that snippet at the end of your </head> tag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.