How to Add Google Analytics to WordPress
As one of the most widely used website statistics services, Google Analytics is offered by Google that generates detailed statistics about a website’s traffic and traffic sources and measures conversions and sales. The regular service is free to use from April 2005, and premium version is available for a fee.
Google Analytics can track visitors from all referrers, including search engines and social networks, direct visits and referring sites. Through this robust website statistics service, you can easily have fully control of your website’s traffic sources. Google Analytics analysis can identify poorly performing pages with techniques such as funnel visualization, where visitors came from, how long they stayed and their geographical position. It also provides more advanced features, including custom visitor segmentation. Such powerful functions help you to have a better understanding of your customers’ needs and interests, which influence the quality and traffic of your website to large extent.
Besides introducing what Google Analytics is, this WordPress tutorial also aims at teaching you how to add Google Analytics to WordPress.
Step 1. Register Google Analytics
Visit Google Analytics, create a new Google account or sign in your existing account. Complete the registration according to the instructions.
Step 2. Get tracking ID & code
After registration, connect Google Analytics with the website that you want to track. Filling the form with required information, such as website’s name, website url, choose the industry category and select a reporting time zone. Finished by click on the “Get Tracking ID” button.
Then move to your Google Analytics Profile, navigate to “Tracking Info” and you will see that the system provides you with a Tracking ID and some tracking code. Copy these tracking codes for further use.
Add Google Analytics to WordPress
There are two commonly used methods of adding Google Analytics to WordPress:
1. Adding Tracking code manually
You can add tracking codes to three different places in WordPress, including Text widget, header.php, and footer.php.
If you choose to add tracking codes to Text widget, Google can only track the data of the widget’s page. But if you amend header.php and footer.php files, Google Analytics can cover the entire website.
1) Add Text widget
Go to Dashboard -> Appearance -> Widgets. Find the Text widget in the left Available Widgets area, and drag it to the place you like to display in the right area. (If choose Displayed Everywhere, the widget will be displayed in every page of your website. Different themes support different widget-available areas.)
Then type in a title, paste the tracking ID you have got from Google Analytics and save the settings.
2) Amend header.php file
Go to Dashboard -> Appearance -> Editor, find out header.php from the right Template list and click to open it.
Search for <head></head> in the left edit box, and paste the tracking ID between <head> and </head>. Finally click on the “Update File” button.
3) Amend footer.php file
Go to Dashboard -> Appearance -> Editor, find out footer.php from the right Template list and click to open it.
Search for <footer></footer> in the left edit box, and paste the tracking ID between <footer> and </footer>. If you cannot such codes, paste the tracking ID before the ending mark </body>. Finally click on the “Update File” button.
2. Applying Analytics plugins
If you think that adding codes is too complicated, you can use a plugin, which named “Google Analytics for WordPress”.
1) Go to Dashboard -> Plugins ->Add New, search for “Google Analytics for WordPress”, install and activate it.
2) Go to Dashboard -> Settings -> Google Analytics, navigate to Analytics Profile, click on the button to authenticate with Google or enter your UA code manually.
3) Choose the displaying place of the tracking code, amend more specific setting if you need, and finally save the settings.
All of the above mentioned methods take you only minutes to add Google Analytics to WordPress. If you are running a business website through WordPress, Google Analytics is a necessity. With the all-rounded statistics offered by Google Analytics, you won’t miss anything about your website. Have a try now, and welcome to share with us your experience.