I'm trying to track views, clicks of listings in ecommerce store made in rails. I need to add a column in events table which has data of listing such as listing_id, name(listings).every listing has unique track data(no of visits,click track). Tried js way like this
document.addEventListener("turbolinks:load",function(){
document.querySelector("#BUYNOW").addEventListener("click",function(e){
ahoy.track("BUY IT NOW",e.target.dataset);
});
});
this is the button I'm trying to track
<%= link_to "BUY IT NOW", new_listing_order_path(@listing), class: "btn btn-primary"%> |
ahoy events db shows --id,user_id,name,properties,time
I need to add a column stating the listing id