function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Do you wonder how often your users are clicking that button? -> Salesforce Mini Analytics!

Hey community,


I just deployed some new buttons and was wondering how often they would click it. So I developed a simple Analytics solution.


It's basically an Object with only one property (A number field) and a web-service class which has a method to increment the "number" for every click.


For every button you want to track you simply add this code:


{objectOrEventName:'My super-duper Button'}); 

 Note: Button must be of type "Execute Javascript". So if you only call an URL so far, you should change that to "Execute Javascript" and put your URL in a "window.location":


window.location = '/some/url';



Now, if you click your Button(s) it will create a Mini Analytics object first and for every future click increment the "number". This will give you a list like this:



.. and there you go. Now you definitely know that all the training is needless - because they won't use your solutions anyway ;)


You can download the package from the AppExchange;

For Sandbox

For Dev / Live


Just install, deploy, grant access for admins only is OK and do not forget to enable the Apex Class for all profiles!


The package is non-managed and has not undergone any security review. So if any well known person is around and could check on the 20 lines of code and write that they are safe, that'll be great ;)


Hope you enjoy this and I am curios about some feedback.






This is so cool.  Thanks for sharing!