Button with counter

I hope I may present the following problem. I have created a simple page with two buttons for readers to order a free book. They can choose a book for iPad or laptop/computer by pressing one button. I would like to connect a counter to those buttons that registers how often one of the two books is downloaded. I guess I'll have to connect an extra script to each button, but unfortunately, I don't know how to make that script with the counter.

Would be very happy with help.

This looks like a job for Web Analytics. Here's what I would likely do if I wanted to track button clicks...

  1. Download and install Matomo on a web server — https://matomo.org
  2. Add the JavaScript tracking code to the page.
  3. Add the "onclick" code. It's explained here — https://matomo.org/docs/event-tracking/


  • It's a bit technical. (It's not terrible though)
  • You'll need a web host to run the software... something that supports PHP/MySQL
  • Now you have to maintain web analytics software. (It's not too bad, generally, but could be really rough if something goes horribly wrong.)
  • There are privacy issues. (Matomo is pretty good about this. There are settings to handle GDPR issues.)


...and no... I don't work for Matomo... but I did consider it. :smile:


Photics, thank you very much for your unbelievable quick response. I have signed up and am going to study matomo.
I hope it will work out with my limited knowledge of programming.

You don't need to sign up to use Matomo, but you can pay Matomo to do the hosting for you. If you have a lot of traffic, that option could get expensive... but I suppose that's relative. If the information helps you save money or improve sales, then $29 a month for tracking 50,000 page views (Cloud plan) might not seem so bad.

There's not much programming here.

<a href="mailto:name@example.com" title="Email Us" onclick="_paq.push(['trackEvent', 'Contact', 'Email Link Click', 'name@example.com']);">Email Us</a>

An "onlick" event added to a hyperlink should get it done. It can be added as JavaScript code too. That involves programming...


...but it's not too bad.

Photis, I thank you really very much for your efforts but I'm still looking for a solution. As a complete programming layman it is very difficult for me to understand why there is no possibility to make a script only within Hype that easily triggers a counter when choosing between two possible answers. I made another example to avoid becoming boring:
Please anybody, make my day…

Lots of ways to do this, here's a good example that doesn't require a database:


Wow, as I had hoped there are many different possibilities within Hype...
Now I can ask an old pupil of mine to help me solve this.
Great answer. Thank you Daniel