Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Josip 89 posts 358 karma points
    Mar 12, 2019 @ 12:37
    Josip
    0

    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?

  • Josip 89 posts 358 karma points
    Mar 15, 2019 @ 10:42
    Josip
    0

    Any ideas?

  • Frans de Jong 462 posts 1585 karma points c-trib
    Mar 15, 2019 @ 16:04
    Frans de Jong
    0

    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

  • Josip 89 posts 358 karma points
    Mar 15, 2019 @ 17:07
    Josip
    0

    In that case i would need to create custom table or there is another way?

  • Paul Seal from codeshare.co.uk 347 posts 1815 karma points MVP c-trib
    Mar 15, 2019 @ 16:55
    Paul Seal from codeshare.co.uk
    100

    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

  • Josip 89 posts 358 karma points
    Mar 15, 2019 @ 17:03
    Josip
    0

    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?

  • Frans de Jong 462 posts 1585 karma points c-trib
    Mar 19, 2019 @ 08:17
    Frans de Jong
    1

    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

Please Sign in or register to post replies

Write your reply to:

Draft