Warning: Table './schoonz_drupal7/watchdog' is marked as crashed and last (automatic?) repair failed query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";N;s:8:\"%message\";s:30:\"Function split() is deprecated\";s:5:\"%file\";s:63:\"/home/schoonz/public_html/sites/all/themes/zen/zen/template.php\";s:5:\"%line\";i:132;}', 3, '', 'http://www.schoonzie.com/how-to-track-drupal-comments-as-goals-in-google-analytics', '', '54.163.91.250', 1413845199) in /home/schoonz/public_html/includes/database.mysql.inc on line 128
How to track Drupal comments as goals in Google Analytics | Schoonzie

How to track Drupal comments as goals in Google Analytics

190 comments

I was inspired by this episode of SEOMoz's whiteboard friday where Rand talks about tracking non-traditional conversions (like when someone posts a comment on your blog) so I decided to check out how easy this was to do in Drupal.

By default, when someone submits a comment, they are redirected back to the node to view their comment (even if it needs approval first). This causes a problem because it doesn't really give us a unique URL to use as a goal in Google Analytics (unlike the webform module).

What you'll need to do is grab the great actions module which we will use to redirect the user to a custom thank you page once their comment has been submitted. And while thats downloading and installing, create a new page that will be the thank you page when users submit a comment.

Next, navigate to Site Configuration > Actions and create a new advanced action to redirect to your new thank you page click save. Now, just head over to the Triggers settings (Site Building > Triggers > Comments) and assign your new action to the "After saving a new comment" trigger.

Make a new advanced action available

Now all you need to do is setup the goal in Google Analytics and wait for the data.

Do you have any other non-traditional conversions that you're tracking? If so, what are they and how are you tracking them?