Support » Plugin: Comments - wpDiscuz » Track Comments in Google Analytics

  • Resolved jupplidhupplid


    I was wondering how I would go about pushing a google analytics event on new comment post with wpdiscuz?

    Is there a callback in wpdiscuz that we can use on new comment post?


    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @jupplidhupplid,

    Please follow the steps below:

    1. Put the following code in the active theme’s functions.php file:

    add_filter("wpdiscuz_comment_post", function ($response) {
        $response["callbackFunctions"][] = "myFunction";
        return $response;

    2. This code should be added in the active theme’s JS file:

    wpdiscuzAjaxObj.myFunction = function () {
        //here should be added the custom code for tracking comments in Google Analytics


    Works like a charm! Thanks 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Track Comments in Google Analytics’ is closed to new replies.