I have an application that has a simple form submission (an email). I have MixPanel's tracking analytics integrated into the app, and want to track every time an interaction with this form happens--specifically, when a user successfully/unsuccessfully submits the form, and what their email is.
After doing some research, it seems simplest method is to track at the controller level (where I am running validations, and making the overall decision whether or not the submission is legitimate). This would require running a JS function from the controller. Is this possible? Is there a better method of doing this?
Let integrate this gem analytical.
Then just follow the instruction in above link, but here is the summary:
analyticalto your controller
Setup mixpanel token in
production: mixpanel: key: your_mixpanel_project_token development: # Also define here if you want to test in development test:
Track your event in controller:
# data_key_1, data_value_1, data_key_2 and data_value_2 are the data # which were attached to mixpanel event, they are example, specify yours analytical.event 'Your event', data_key_1: data_value_1, data_key_2: data_value_2
©2020 All rights reserved.