Guest User

Google Analytics Click Tracking

a guest
Oct 16th, 2016
1,623
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. **1. Paste script to your code**
  2.  
  3. <script>
  4.         function track(name,label){
  5.         ga('send', 'event', name, 'click', label, {
  6.             hitCallback: function(){
  7.             console.log('Event sent to Google Analytics');
  8.                 }
  9.             });
  10.         }
  11. </script>
  12.  
  13. **2. Add onclick to your links**
  14.  
  15. <a href=linkonclick="track('Click-Name','Click-Label')">Link</a>
RAW Paste Data