Wordpress news and rumors

Google Analytics for your website

If you have a WordPress page or blog and want to monitor traffic and statistics of your site, you must install Google Analytics, the best tool in the market, and there are two different ways to do it, a simple way with WordPress plugins a little more advanced, with HTML code.

1. With WordPress plugins

There are WordPress plugins to install Google Analytics on your site, quickly and easily, without having to learn about HTML code. You just need to have a Google Analytics account, only with the UA code that gives us the Google tool. There are 3 plugins: Simple Google Analytics, Google Analytics by Yoast and Google Analyticator.

The main advantage is that only with UA code, the main disadvantage is that you are using a plugin to install something that you could do with HTML code.

Whenever you can do, avoid installing a plugin, makes your website lighter and you optimize loading times of your web page, don’t occupy space on your server, and avoid possible conflicts between plugins when you have others installed. Besides, Google takes into account the load times of your website for SEO positioning.

2. HTML code <head>.

If you are a little more advanced WordPress user and knows some HTML code, you have another alternative: copy and paste the Google Analytics code directly into the <head> of your website. If you have designed web pages in HTML you know that in every HTML page code have at the top a <head> opening and another </ head> tag. Between both, opening and closing tags, there are a number of code lines which usually links to the site stylesheet, fonts, javascript files, etc. 

In the case of WordPress, is a PHP-based language system, and pages are built dynamically, that implies that to create each page, the tool takes portions of code from different files and thus builds them intelligently. Typically the site files, there is one called header.php which includes all the HTML code to be added to all pages of the site, as a result, they all have the same header.

Therefore, to implement the Google Analytics code, you have go to the WordPress editing panel and then go to header.php file, which you will find on the top the entire HTML code of the site header : <head> <meta> <title>, etc. Here you have to do is paste the code of Google Analytics in a line that is between <head> and </ head> . Once you've done this, Google Analytics can start to track the statistics of your website or blog.

Like we notice before, the main advantage is that you save installing plugins, so you optimize site speed. Remember plugins are a wonderful help and one of the strengths of WordPress, but if you abuse them can become a big disadvantage of your website. When you can do it without plugins, do it without plugins.

The disadvantages: requires more advanced knowledge of HTML code, and take the risk to edit a .php file, because if the code is not in the right place or you delete or modified subject lines of code, you can ruin their proper functioning and finally having to reinstall everything again. 

Therefore, before making the decision, think what you'll need exactly and values if you have the knowledge necessary to venture to modify the code of your theme or template or use a plugin.