How to make user accept license agreement before download

Not being able to find anything I finally went ahead and created the WordPress plugin Terms before download. From the plugin’s description:

Terms Before Download adds a shortcode that can be used instead of
HTML anchors to link to downloadable files. If such a link is clicked
a popup dialog shows terms and conditions (EULA) which must be
accepted for the download to start.

The terms and conditions are read from a WordPress page. That way
there is only a single place to maintain the terms and they can easily
be displayed independently of the plugin.

The plugin supports Google Analytics to keep track of the number of
downloads.