The thing I enjoy the most about being an online business owner is this: Nobody can take away what I have built with SBI! - John Shank, SBI! member since 2003

Add Google Analytics Tracking Code to Your WordPress Site

Written By: SiteSell in How Solopreneurs Build Their Business, WordPress | February 9, 2015

Add Google Analytics Tracking Code to Your WordPress Site

Google Analyticator allows you to add Google Analytics (GA) tracking code to each page and post on your site without having to edit any code.

It also allows you to view some GA stats from within WordPress itself.

You must have a Google Analytics account to be able to use this plugin.

If you prefer not to use Google Analytics, there’s a plugin for StatCounter. In your Plugins library, click on Add New and type StatCounter into the search box. Click on Search Plugins. Install the plugin called StatCounter – Free Real Time Visitor Stats.

It will allow you to see StatCounter stats in your WordPress admin panel.

To begin, hover over Settings in your admin panel menu bar and click on Google Analytics.

Activation

You have two choices for activation — showing stats in WP, and not showing them.

Google Authentication

If you want to have stats display in your WordPress installation, you must grant access to this site in Google Analytics.

Log in to your GA account. Back in Google Analyticator, click on either the Click Here link (for a pop-up) or the here link (if you block pop-ups).

Enter your login details and press Enter.

Review the information presented. If you accept, click on the blue Accept button.

Copy the text string that Google provides. Paste it into the text box in the plugin. Click on Save & Continue to close the pop-up and return to the settings.

I Don’t Want To Authenticate Through Google

If you don’t want to give the plugin access to your GA account data, click on Continue Without Authentication to continue. This means that you won’t be able to view statistics in your WordPress dashboard.

The Next Page, Depending on Your Authentication Choice

The choice you made above affects what happens in the following pages. Only the Basic Setup and Admin Dashboard Widgets sections have different instructions. Follow the instructions for your choice.

Basic Setup

What you see in Basic Tracking depends on whether you allowed Google Analyticator to have access to your GA account.

Basic Setup (Authorized)

You’ll see a large warning on a red background that GA integration is currently disabled. To change that, select Enabled in the Google Analytics logging is: menu.

If you have more than one site tracked in GA, select it from the Google Analytics UID: menu.

Basic Setup (Not Authorized)

You’ll see a large warning on a red background that GA integration is currently disabled. To change that, select Enabled in the Google Analytics logging is: menu.

In GA, copy the tracking code for this site and paste it into the Google Analytics UID: text box. See the UID example in the box to ensure that what you copied at GA is the correct information.

Tracking Settings

This section allows you to determine whose stats to include or exclude from the GA reports. If you’re the only person who will be using WordPress, leave all the settings as is. This will ensure that your visits to your site will not inflate your traffic and other stats.

If you will have multiple users (ex., you have a membership module added to your WordPress installation, and some other authors, change the User roles to not track: settings to exclude the people you do not want to track.

Link Tracking Settings

Leave Outbound link tracking and Event tracking settings as is, unless you have a reason to change one or the other of them.

If you’ll be offering file downloads (PDFs, audio files, etc.), enter the extensions that you want tracked by GA. Type in pdf for PDF files, mp3 for MP3 audio files, etc.

Leave the two Prefix options as is if you left Event tracking as is.

If you connected your GA account and your AdSense account, paste the Google AdSense ID that GA provides into the text box.

Additional Tracking Code

Enter any additional tracking code you want to add before or after the GA code.

Admin Dashboard Widgets

What you see in Basic Tracking depends on whether you allowed Google Analyticator to have access to your GA account

Admin Dashboard Widgets (Authorized)

Since you authorized access, you can show stats right in your admin panel. If you want to view stats here, leave Include widgets set to Enabled.

Hide the Display Ad if desired.

Choose the User roles that can see the dashboard widget. We recommend allowing only administrators (you and any other people you gave administrator status).

Admin Dashboard Widgets (Not Authorized)

You’ll see a red message telling you that you have no access to the dashboard widgets because you didn’t authorize Google Analyticator to access your GA account.

Deauthorize and Reset

If you change your mind about having access, click on the Deauthorize and Reset Google Analyticator link. This will take you back to the Activation page (see above). Follow the steps from there for your new settings.

Click on Save Changes to save your customizations for either the authorized or not authorized option.

Don’t miss out on our upcoming tips about WordPress and how to build a profitable online business! Subscribe to the SiteSell Newsletter.

SBI! for WP
Save 33% On Your Online Business!
SiteSell
SiteSell is a privately held Canadian-based company that helps everyday people start profitable online businesses.

Join The Solo Build It! Community

Get the latest in best-practices and advice for your online business. Let each new article be delivered to your Inbox for free.