New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Learn it fast with expert-taught software and skills training at lynda.com. See what you can learn

By Chelsea Adams | Monday, April 14, 2014

How to Install Google Analytics to WordPress in 5 Minutes

Install Google Analytics into WordPress in 5 minutes

If you can copy and paste text, you can install Google Analytics to WordPress. All you need is an established self-hosted WordPress.org website or blog, a Google Analytics account, and five minutes or less.

Note: You can only install Google Analytics on self-hosted WordPress.org sites and blogs. WordPress-hosted WordPress.com blogs won’t let you alter your header file or otherwise make low-level changes to your website infrastructure.

If you first need help setting up WordPress or your Google Analytics account, check out these videos on lynda.com:

Google Analytics Fundamentals: Setting up an account  (members only) • Installing and Running WordPress: Shared hosting (members only)

It’s just 11 easy steps

To add Google Analytics to your WordPress website, all you need to do is add a snippet of code to the header file of your WordPress website.

Follow these 11 steps:

1. Sign in to your Google Analytics account.

2. Navigate to the Admin section of your account by clicking Admin in the upper right of the screen, near the Help option.

1-GA_Admin_in_upper_right

3. Within your Google Analytics Administration view, you’ll see three columns: Account, Property, and View. Under the center column, Property, click Tracking Info. (Note: “Property” stands for web property. Unsure about what this means or the hierarchy of WordPress accounts? Watch our How Google Analytics accounts, properties, and views are structuredvideo.)

3-Click_Tracking_Code

4. If clicking Tracking Info reveals five sub options, click Tracking Code.

5. You should now see your Google Analytics JavaScript (ga.js) tracking code, as below. Copy this code.

2-Copy_GA_JS_Code

6. Log in to your WordPress account.

7. In the left-hand column of your WordPress Dashboard, hover your mouse over the Appearance panel to see the Appearance panel menu suboptions and choose Editor.

4-WordPress_Appearance_Editor

8. Now you’ll see your WordPress template files. Go to the right column and locate your header.php file. Click the header.php file to edit it.

9. Scroll through the .php file looking for the closing head tag, which looks like this: .

You can also do a search for using Command+F on a Mac or Control+F on a Windows PC.

5-Closing_Head_Tag_in_WP

10. Paste your Google Analytics ga.js code into this file right before the tag. So, in your .php header file you will see the following:

>

>

Paste your Google Analytics ga.js code between and.

11. Click Update File to save your changes—and you’re done!

Want to double-check?

If you’re the type who has to see it to believe it, you can confirm that Google Analytics is installed on every page of your website simply by navigating to the page in question and viewing the source code (right-click anywhere on the page and choose View Source Code).

Viewing the page source code, you should see your ga.js code right above the closing header tag () on every page.

To learn more about Google Analytics and WordPress, visit the lynda.com training library where you will find many more Google Analytics video tutorials and WordPress video tutorials.

Learn it from the experts.

With online video courses at lynda.com, you can reach your goals faster. Learn software, improve your skills, and get an inside look at how the professionals work.

See what you can learn


Share this article:

Tags: , , , , , ,

Get the latest news

  •   New course releases
  •   Pro tips and tricks
  •   News and updates
  
New releases submit clicked

You can change your email preferences at any time. We will never sell your email. More info

All articles

Featured articles

A lynda.com membership includes:

Unlimited access to thousands of courses in our library
Certificates of completion
New courses added every week (almost every day!)
Course history to track your progress
Downloadable practice files
Playlists and bookmarks to organize your learning
Become a member

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.