This simple plugin dynamically embeds your Google Analytics Tracking Code in your WordPress theme.
This is a small easy plugin that embeds your Google Analytics Tracking Code inside your theme files dynamically without you needing to hard-code it in your template files.
This is pretty useful if you frequently change your WordPress Theme files, and now you donít need to worry about leaving out your Google Analytics code accidently just because you switched to a new theme.
This section describes how to install the plugin and get it working.
- Download the plugin and upload and unzip to your plugins directory as you would usually do.
- Activate the plugin from your WordPress Admin.
- Go to the pluginís options page to add your Google Analytics Tracking Code. You can find the options page under Settings >> GA Tracking Code
- Save your changes. You have now successfully added your GA tracking code, and it will be automatically added to all your blog pages.
- To verify if your Google Analytics Tracking code has been added correctly, go to any of your blog page and View the source of your page. If the plugin is working correctly you should be able to see your Google Analytics tracking code near to the end of the page (near to the closing tag). If you donít find your Google Analytics code, please refer to the Prerequisites section below.
- Fixed a typo in help text.
- Added support for the new asynchronus google analytics code. Tracking code can now be embeded inside the head section.
- Added more help text.
- Added social plugins to make plugin popular.
- Support for embeding tracking code at the page footer before closing body tag
The plugin requires that your theme files have one of the following action/template tags depending on where you want to place your GA tracking code.
<?php wp_head(); ?>
If you want to place the tracking code inside the head section before the closing </head> tag.
<?php wp_footer(); ?>
If you want to place the tracking code near page end/footer before the closing </body> tag
While these actions/template tags are widely supported by most of the theme authors, chances are there that these actions are not available in your theme file. In such a case, the plugin wonít be able to embed the Google Analytics tracking code to your theme.
However, you can easily edit your header.php file and add the
<?php wp_head(); ?> tag just before the closing </head> tag or for footer place the
<?php wp_footer(); ?> tag towards the end of the file, just before the closing tag.