I mean how do I such a counter inside script?
When using the Solve with Clicks module it counts how often it used the solver on the result page.
Is there a way to add that to with something else?
I discovered what happens: I need to load at least one url before loading the custom js functions. I loaded http://example.com before the custom js functions worked fine in "Run Mode".