There are many plugins available on the web, but you can also create your own 'simple' Google Analytics plugin.


  1. Create new PHP file in /wp-content/plugins folder, for example: examplegoogleanalytics.php

  2. Add the following code in the PHP file

    <?php
    /*
    Plugin Name: SORLAC Google Analytics Plugin
    Plugin URI: http://www.solrac.nl
    Description: Adds a Google analytics trascking code to the <head> of your theme, by hooking to wp_head.
    Author: Carlos Klop
    Version: 1.0
    */function wpmudev_google_analytics() { ?>

    // Paste your Google Analytics Javascript code here

    <?php }
    add_action( 'wp_head', 'wpmudev_google_analytics', 10 );
    ?>


  3. Enter the WordPress Admin and activate the plugin.


If this solution is not working check if your theme have the wp_head hook in the header.php available.