Download tracking

Hi, I would like to be able to track download files, I am using this code but it does not work. I am able to track page views but not goals.

Here are some of my setting for goal management – see the attached image for details.

Thanks for your help.

Code below:

check this method