How to track specific events with API

Created by LiRou C, Modified on Wed, 8 Nov, 2023 at 1:27 AM by Donald Ng

Mida allows you to send events by using Javascript when specific actions take place on your website. An event is a data point representing an interaction between a user and your website. 


With Javascript, you're able to set up your own criteria to determine what kind of action results in an event being sent to Mida. 

Below is the use case for the event:

1. Send an event to Mida to let you know when a user loads a specific page variant during an AB test. 


mida.track("ab_testing",{"variant_name": "variant A"})  
JavaScript
JavaScript


3.  Send an event to Mida when users click on a specific button on your website.


mida.track("subscribe")
JavaScript
JavaScript


Note: You can provide the name of the event as the first argument. Optionally you can add data to your event by providing an object as a second argument.

 

Alternatively, you can also add it as a HTML attributes mida-event:


<button class="btn" mida-event="click-cta">Create a free account</button>

Whenever, someone clicked on the CTA button it will trigger an event with the name "click-cta".

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article