Where NOT to put your Google Analytic Code!

It’s not rocket science. I am not a pet. What I do is solid coding 🙂

Few days ago one of my clients wanted me to put analytic code at the bottom of his website. So I had to write a log email for him. I am just gonna write this article based on that email ( you all know I am a busy man and I like to save time when I can 🙂 )

What was my clients logic?

He wanted me to make his website super fast. He read that if we place the java-script at the bottom of the page it increase page speed. Well, he was right. So what was the play here? If we place the code at the footer ( just before the </body> tag that means the code will load last. That means the page will load faster and once the page loaded the js files will be loaded. No big deal right?

Hell, no. Here is my logic

What actually analytic do? It track people on your website, what they do, how long they stay etc… ( I know, you all know about this ). Say your website loads within 10 seconds. It means if you place the analytic codes at the bottom the analytic code will load after 10 seconds of your website loaded. That means google will blind for those seconds. So it will not track any visitors data for those second and it is too bad for your SEO. Your visitors might have click a link within that 10 seconds and google will never known about it ( you see, even 10 second is here important ). Also you will loose average session duration smaller than the actual time your visitors are spending on your website.

You see my point. If you are going to save 1 second actually you are loosing more to be invisible to google 🙁 Too bad, right?

Where should I place it?

Before the <body> tag. In our WordPress themes we already applied it long ago. Visit here Appearance >> Theme Options >> General Settings >> Google Analytics Code. Just place the code as it is and you are done.

 

Related posts:

Three Common Qualities of aSuccessful Mobile Marketing Campaign
Simply Having an App isn’t Enough And Never Was.
Six Tricks Your Competitor Knows About Cloud Marketing Applications
DA PAM 385-63