Categories
WordPress Tips

My Two Cents on Where to Add Google Analytics in WordPress Part II

In my previous article, I gave my two cents on where you should add the Google Analytics code in WordPress. After fiddling around trying to optimize another site of mine’s, I discovered that this will probably do little to help improve page speed. It does delay the parsing of JavaScript since the client browser reads the HTTP GET request line by line, and it’s at the end, but the effect is probably minimal. I did discover that I could use the script defer attribute to delay the processing, and it had a greater impact. Even though the HTML5 specifications indicate that it should not be used without the src attribute, I tried it, and it appeared to have a greater effect, at least in Chrome. (I know that it may not work with all browsers because each browser will implement it differently.) I can at least say it did solve some problem with my webpages rendering correctly after I redesigned them using Responsive Design, so you might want to consider giving it a try.