Title: Log click
Last modified: October 17, 2016

---

# Log click

 *  [mungle](https://wordpress.org/support/users/mungle/)
 * (@mungle)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/log-click/)
 * Hello! I need to log some links with this plugin (I need this way, not alternative
   plugins) so I made this:
 * **my content page**
    `<a it="test-tracking1" href="#" class="track">Test Tracking
   </a>`
 * **theme footer.php**
 *     ```
       <script type="text/javascript">
   
       $(document).ready(function() {
           $(".track").click(function() { tracklink(); });
       });
   
        function tracklink(el) {
           var the_id = $(el).attr("id");
           var test = "test";
            $.ajax({
                type: "POST",
                url: 'functions.php',
                data:{action:'track', nome:'<?php echo $trackinguser; ?>', titolopagina:'<?php echo $trackingtitle; ?>', pulsante: the_id},
                success:function(html) {}
            });
       };
       </script>
       ```
   
 * **theme functions.php**
 *     ```
       if($_POST['action'] == 'track') {
   
       $linktrackingtitle=$_POST['titolopagina'];
       $linktrackinguser=$_POST['nome'];
       $linktrackingbutton=$_POST['pulsante'];
   
       do_action( 'wp_log_info', 'Click', $linktrackinguser . ' ha cliccato su ' . $linktrackingbutton . ' in ' . $linktrackingtitle );
       }
       ```
   
 * But it doesn’t work… What’s wrong?
    Thank you!

Viewing 1 replies (of 1 total)

 *  Plugin Author [webheadcoder](https://wordpress.org/support/users/webheadllc/)
 * (@webheadllc)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/log-click/#post-8316949)
 * Hi,
 * Thanks for trying out the plugin. It looks like you are using ajax which requires
   a little more than just checking the $_POST variable. Please see the WordPress
   codex for more help on ajax: [https://codex.wordpress.org/AJAX_in_Plugins](https://codex.wordpress.org/AJAX_in_Plugins)

Viewing 1 replies (of 1 total)

The topic ‘Log click’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-log-action.svg)
 * [WP Log Action](https://wordpress.org/plugins/wp-log-action/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-log-action/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-log-action/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-log-action/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-log-action/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [webheadcoder](https://wordpress.org/support/users/webheadllc/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/log-click/#post-8316949)
 * Status: not resolved