By Chelsea Adams | Monday, April 14, 2014
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.
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.)
4. If clicking Tracking Info reveals five sub options, click Tracking 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.
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.
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.
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.
Share this article:
Tags: Google, Web Design, Online Marketing, Analytics, Web Development, Chelsea Adams, Google Analytics
You can change your email preferences at any time. We will never sell your email. More info
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:
Keep up with news, tips, and latest courses with emails from lynda.com.
We've updated our terms and conditions (now called terms of service).Go Review and accept our updated terms of service.