title: Vuejs Event tracking using Google analytics
body: <p>I am looking to track google analytics events on buttons and links.  In jquery typically, I would pass values in data-attributes and fetch them and call required function. I understand I shouldn't be using data-attributes so I am looking out for the best way of doing this , there can be multiple buttons that performs different tracking with different data-purpose (attribute) So I will need to pass data-purpose and data-user to the vue component/function</p>
  
  <pre><code>&lt;button id="openmodal"  data-purpose="contact form" class="btn__primary" aria-label="Help" @click="contactForm"&gt;Contact Form&lt;/button&gt;
    &lt;button id="openmodal"  data-purpose="Opt In" class="btn__primary" aria-label="Help" @click="optIn"&gt;Opt In&lt;/button&gt;
  </code></pre>
  
  <p>In analytics</p>
  
  <pre><code>ga('send', {
    hitType: 'event',
    eventCategory: 'button',
    eventAction: 'data-purpose',
    eventLabel: 'VALUE OF BUTTON'
  });
  </code></pre>