skip to Main Content

I am using Komito Analytics to track Events in Google Analytics.
So far they are doing good.
I would like to create 2 different buttons with different ids or classes and track them separately.
is that possible?

2

Answers


  1. You can count the number of clicks on the button with Javascript

    <button id="komito">komito</button>
    
    
    <script type="text/javascript">
            var count = 0;
            var btn = document.getElementById("komito");
      
            komito.onclick = function () {
                count++;
    console.log(count);
            }
        </script>
    
    Login or Signup to reply.
  2. Depending on your needs and current implementation, you can use one of the following methods:

    1. Enable trackForms to track forms submissions and wrap each button in a <form> element:
    <form onsubmit="return false">
      <button type="submit" name="action1">Button 1</button>
    <form>
    <form onsubmit="return false">
      <button type="submit" name="action2">Button 2</button>
    <form>
    
    1. Enable trackActions to track CTA actions for links and use links instead of buttons:
    <a href="javascript:void('action1')">Links 1</a>
    <a href="javascript:void('action2')">Links 2</a>
    or
    <a href="javascript:'action1';void 0">Links 1</a>
    <a href="javascript:'action2';void 0">Links 2</a>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search