Skip to content

Instantly share code, notes, and snippets.

@WordPress-Handbuch
Created February 7, 2019 14:19
Show Gist options
  • Save WordPress-Handbuch/9fffa538cb2ad24fa042159dddea7bb7 to your computer and use it in GitHub Desktop.
Save WordPress-Handbuch/9fffa538cb2ad24fa042159dddea7bb7 to your computer and use it in GitHub Desktop.
Example PHP/jQuery Matomo fragment to track form field clicks in the plugin »Quiz and Survey Master« (V6.2.0, class-qmn-quiz-manager.php, insert at line 314)
$quiz_display .= "<script>\n";
$quiz_display .= " jQuery(document).ready(function () {\n";
$quiz_display .= " jQuery('.qmn_quiz_form input').click(function () {\n";
$quiz_display .= " _paq.push(['trackEvent', 'Quiz', 'Klick', jQuery(this).attr('ID') + '-' + jQuery(this).attr('value')]);\n";
$quiz_display .= " });\n";
$quiz_display .= " });\n";
$quiz_display .= "</script>\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment