Comments are really important to track, if you want to create a successful blog, for a number of reasons:
- Comments create community
- They add fresh, new content for search engines to crawl
- Comments give you feedback
Tracking comments in Google Analytics lets you see what drives people to comment on your blog.
How to do it
1. Open up your WordPress Dashboard, browse to “Appearance”, “Editor” and find your comments code (usually, “comments.php”).
2. Find the code that has something to the affect of “method=”post”” and “action=”<?php echo get_option(‘siteurl’); ?>/wp-comments-post.php””.
3. Insert the following code within the
<form> tag itself.
If you have the normal GA code (this is most likely the one you need):
Or, if you have the Asynchronous GA code (advanced users):
<form id="commentform" action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" onSubmit="_gaq.push(['_trackPageview', '/tracking/comment-submit']);">
4. Setup the goal in Analytics
Login to your account, click “Edit” beside your profile and “Add new goal”. You want to use URL destination as your goal type and in the goal URL, use exact match for “/tracking/comment-submit” (without quotation marks).
Save that and you’re done! You’ll start seeing more actionable insights from your analytics from this point on.