User Tools

Site Tools


Google Analytics plugin

create a 'googleanalytics/' folder, and create the plugin.googleanalytics.php file with the contents below. Make sure to change UA-xxxxxx-x to your google tracking ID. Add googleanalytics to the plugins panel to activate.

Plugin Name: Google Analytics
Plugin URI:
Description: Adds the google analytics trackng code
Author: Lord Loh.
Version: 1.0
Author URI:
function plugin_googleAnalytics() {
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "' type='text/javascript'%3E%3C/script%3E"));
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
} catch(err) {}</script>
add_action('wp_footer', 'plugin_googleAnalytics');
res/plugins/lordloh/googleanalytics.txt · Last modified: 2019/01/12 17:53 (external edit)