Plugin Planet

Premium WordPress Plugins

GA Pro makes it easy to display your Google Analytics tracking code in either the <head> or footer (before the closing <body> tag). But those are not the only places that you can add your tracking code. This article explains how to include your GA tracking code in any location by adding a line to your theme template.

For example, some GA techniques recommend including your GA tracking code just after the opening <body> tag, which is just so convenient for WordPress users. Just kidding, it actually requires a custom tag added to your theme in the desired location. So you will need to edit your WordPress theme in order to comply with Google’s particular code placement. Here is an example of how to achieve this using GA Pro.

Step 1: Add the following line to the location in your theme template where you want to include your Primary GA tracking code (for example, after the opening <body> tag in the header.php file):

<?php do_action('gapro_after_body_open_tag'); ?>

Step 2: Visit the plugin setting “Tracking Code Location”, and choose the option to “Include tracking code in custom location”. Save changes.

Done! Your Primary GA Tracking code will now be displayed wherever you added do_action('gapro_after_body_open_tag'). You can verify the correct location by examining the source code of your web pages. For more infos, visit the Help tab on the plugin settings page.