I've found this solution which triggers an email alert when an article is viewed, but wondered if a similar technique is possible for when a specific file is downloaded?
function article_email_alert() {
global $post;
if( $post->ID == 1234) {
wp_mail( '[email protected]', 'Alert', 'The article was visited.' );
}
}
add_action( 'wp', 'article_email_alert' );