DEV Community

Cover image for How to Add Google Analytics to WordPress
Kevinleary.net
Kevinleary.net

Posted on Originally published at kevinleary.net

How to Add Google Analytics to WordPress

So you’ve signed up for Google Analytics and you want to set it up on your WordPress blog.

Get the Ultimate Google Analytics Plugin

Download and install the plugin, log in to your WordPress control panel, and then enter your Google Analytics account ID under Settings \ Ultimate GA.

What is a Google Analytics Account ID?

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "https://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview();
} catch(err) {}</script>
Enter fullscreen mode Exit fullscreen mode

In this case var pageTracker = _gat._getTracker(“UA-XXXXXXX-X”); shows your Google Account ID to be UA-XXXXXXX-X.

Advanced Features

Ultimate Google Analytics has a number of advanced features you can integrate with your Google Analytics account to track the number of clicks to download links, mailto links and outgoing links.

Top comments (0)