Hi,
Is there a way I can track and show the number of clicks on a button in my memberstack dashboard area?
Thanks
Hi,
Is there a way I can track and show the number of clicks on a button in my memberstack dashboard area?
Thanks
Hey,
I created a solution for myself. If anyone would like to copy. Firstly, I have created a hidden field called receitas-geradas in memberstack. I also inserted the ms-data : receitas-geradas attribute in the text block I wanna to show the updated numbers. For the button, I created the ID called addCount and used that with JQuery at the end of my code. See full code:
<script type="text/javascript" src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script>
MemberStack.onReady.then(function(member) {
var receitas_geradas = member["receitas-geradas"];
var receitas_geradas_parsed = parseInt(receitas_geradas);
function criaCounter(init) {
var count = init || 0;
return function() {
count++;
receitas_geradas_parsed = count;
member.updateProfile({
"receitas-geradas": receitas_geradas_parsed
}, false)
}
}
$('#addCount').click(criaCounter(receitas_geradas_parsed));
})
</script>
Hey Othon
Thank you for this! I am adding this to an article now to put in the help center!!!