Google Analytics is just about a standard necessity to have when creating a website, especially for web stats. A lot of new website owners aren’t sure where to implement it, especially with WordPress.
Google has developed their Analytics product to help you track as much of your website, as well as social engagement. Below are two ways on how to set up Google Anaytlics in WordPress.
How To Set Up Google Analytics In WordPress – Without A Plugin
If you are comfortable editing your theme’s template files and prefer to not use a plugin, then this method is for you.
Below is a general generated tracking code from Google Analytics.
ga('create', 'UA- ', 'yourdomainname.com');
Replace the UA with your analytics ID that Google gives you. Note: If you’re having issues finding the tracking code, go log into you Google Analytics account, and then under Admin> Tracking Info> Tracking Code. Copy that as it has your Analytics ID in the code.
However, if you know your Analytics ID for your website, replace the yourdomainname.com with your site’s domain.
Add the code to your header.php file in your theme folder before the ending </head> tag. If you prefer to place it in the footer, find your footer.php file and place it before the ending </html> tag, but after the </body> markup tag.
You could also create a file called googleanalyticstracking.php, paste the above code, and then include the line
<?php include_once("googleanalyticstracking.php") ?>
Again, this file can be placed in the same areas specified above.
How To Set Up Google Analytics In WordPress – With A Plugin
If you don’t want to mess with touching any code except copying and pasting your Analytics ID for your website, then Google Analytics or WordPress by Joost de Valk would be a great and easy solution to use.
Once you’ve installed the Google Analytics for WordPress plugin, you can sync your Google Analytics account with it.
The options for Google Analytics for WordPress are fairly cut and dry. The plugin basically asks you on what you want to track or not to track. All you do is select what you want to track and save. If you need to track more, there are some really in depth settings to track things like Internal links, outbound links, authors, logged in users, post types, categories, downloads, and much more.
Of course, there are a ton of other Google Analytics related plugins, but this one does a lot to help you track as much of your site as possible. For some, having all of these options at their disposal may be intimidating, but that’s okay. With a little time and learning, anyone can take advantage of all of the features of the Google Analytics for WordPress plugin.
Have you installed Google Analytics on your WordPress powered website? If so, what method did you use? If you used a plugin, did you use the one mentioned above?