Members on their profiles have collapse button which shows the phone number on click and i would like to count this clicks in the database for each member.
Later i would like to show them this numbers when they log in in their profiles.
I found articles which count page visits but i need to count clicks on buttons.
What would be the best approach?
Maybe i could create custom table in the databsae and than somehow make relation with members (I never tried it in Umbraco), or i can use Google Analtics maybe?
Also notice the optional attribute data-event-value I would pass the integer id of the member into that. Now you have all of the data you need, using Google Analytics so no need to create database tables or any custom code other than a bit of javascript to send it to GA.
Click counter by clicking the button
Members on their profiles have collapse button which shows the phone number on click and i would like to count this clicks in the database for each member.
Later i would like to show them this numbers when they log in in their profiles.
I found articles which count page visits but i need to count clicks on buttons.
What would be the best approach?
Maybe i could create custom table in the databsae and than somehow make relation with members (I never tried it in Umbraco), or i can use Google Analtics maybe?
Any ideas?
What you could do is add a javascript eventhandler on the button click. In that event call a surface controller and store the new number.
Documentation on surfacecontrollers
In that case i would need to create custom table or there is another way?
I would use Google Analytics Event tracking for this.
See this blog post for an easy way to do it.
https://codeshare.co.uk/blog/how-to-set-up-ga-event-tracking-in-3-easy-steps/
Also notice the optional attribute
data-event-value
I would pass the integer id of the member into that. Now you have all of the data you need, using Google Analytics so no need to create database tables or any custom code other than a bit of javascript to send it to GA.Cheers
Paul
Great article i will give it a try, do you think it will be easy to display number of clicks for each member in their frontend member profile?
Looks like it's possible to request tracking data from analytics
https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/web-js#2setupthe_sample
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.