WordPress.org

Ready to get started?Download WordPress

Forums

WP-Piwik
[resolved] Request: Track Comments as Goal (Conversion-Tracking) (8 posts)

  1. mampf
    Member
    Posted 1 year ago #

    Hi there,

    is it possible to hook the input-tag of wordpress comments? If so, we could have this:
    http://www.seoptimise.com/blog/2011/01/simple-goal-conversion-tracking-with-piwik-the-open-source-google-analytics-alternative.html

    In short:

    1. Define a new goal
    2. Get Tracking number
    3. Set input onsubmit or onclick-Function to onclick="piwikTracker.trackGoal(3)".

    Another way of version tracking would be interacting with 2click button plugin: https://wordpress.org/extend/plugins/2-click-socialmedia-buttons/

    http://wordpress.org/extend/plugins/wp-piwik/

  2. braekling
    Member
    Plugin Author

    Posted 1 year ago #

    The fastest way to do so is just to change your themes comments.php.

    But I'll keep this in mind. At least the Piwik API allows to implement goal features to WP-Piwik. So why not use this?

  3. mampf
    Member
    Posted 1 year ago #

    Where would you put it? As I pointed out, modern themes' comment.php don't provide an input tag anymore.
    See yourself. Instead of printing an input and form field, they only call comment_field().

    So there is no easy to do this as you suggested. That's why I asked for a hookor so.

    Thanks, Ben

  4. braekling
    Member
    Plugin Author

    Posted 1 year ago #

    Just a quick & dirty solution (core changes):
    http://kikolani.com/how-to-set-up-blog-comments-goals-google-analytics-wordpress-hacks.html See method 2, "Other WordPress Themes".

    Maybe it will help to add a WordPress hack which calls comment_form, changes the submit button (e.g. str_replace) and prints the result.

    Or you can use jQuery and trigger the function on submit.

    I have no experience using comment_form and its arguments... maybe it provides a simple solution. Anyone here who can help?

  5. mampf
    Member
    Posted 1 year ago #

    Hi there,

    I found the plugin "custom headers and footers" handy from time to time. In conjunction with your jQuery-idea I was able to put the following code to my blog's footer:

    <script lang="text/javascript">
    jQuery(document).ready(function($) {
    	$('form#commentform input#submit').click(function() {
    		_paq.push(['trackGoal', 3]);
    	});
    });
    </script>

    Change the goal# to your own goal id. That's it. Seems to work properly.

    Can you implement that or sth similar in your plugin?

  6. braekling
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you very much. I will add this in 0.9.9.6.

  7. mampf
    Member
    Posted 1 year ago #

    Great, thanks! Topic is resolved then.

    I really wonder that there is only so few feedback from other users. Probably it will gain more as soon as the feature is implemented.

  8. braekling
    Member
    Plugin Author

    Posted 1 year ago #

    Due to some major bugs I released 0.9.9.6 before this functionality was added and tested. But 0.9.9.7 will follow soon.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic