I have a site with content that can be "liked". Not using any api for this, its a custom like button, simply incrementing the "like" stats for the piece of content.
Now, I have a views counter, on each page load, and a like button. Upon pressing the like button, it gets disabled for any consecutive likes for that page life cycle.
I am experiencing an issue, where my likes are more than my views.. which in theory should not be able to happen. I have since implemented some java code to de-wire the button (hide the element basically), and I have also added some server side code for robots that ignore java.
Ons server side button press, I set a session variable, and exit out of any consecutive events that get raised if this session variable is set for that instance of the page.
I have gotten it down to at maximum two or 3 events that get fired when I rapidly click on the button to past back. Only after the 2nd/3rd run has enough time lapsed to recognise the session variable, and the event code is ignored. Before my session var trick, you could rapidly click the button 10 times, and it would increment 10 likes before the page eventually posted back and disabled the button.
So, down to 2 or 3 isn't bad, But I am consistently getting more likes than views on some content.
- My views are counting fine, I double checked that.
- My likes definitely only catch the first disable/session var trigger/event after a couple of unwanted event fires... (rapidly clicking)
- I suspect its search engines maybe following links...?
Supplementary info: jquery button disable:
<script type ="text/javascript">
function pageLoad() {
$('#<%=vidUpB.ClientID%>').click(function () {
$(this).css("display","none")
});
}
</script>
Any ideas?