About JavaScript track goal

I want to use JavaScript to track goal to count conversions.
I write a line:

<a href="#" onclick="_paq.push(['trackGoal', 2]);">test</a>

in a page which is inserted tracking code.

And I have one goal’s ID is 2.
But the conversion count will not increase no matter how I click it.

Please help me.
Thanks.
Arthur