I have just simplified the code, and put the full URL in the data-url property, and the permalink URL in the counturl property. I noticed that it only works and counts properly when I remove the counturl property.
Is there any reason why adding the counturl property breaks the counter?! The permalink does not redirect to the full URL though, but it is a link that will stay valid, even when the slug has been changed, which is what the purpose is for the counturl, right? Or am I seeing things wrong?
Sorry if I sound frustrated, but this has been bothering me for weeks!