You could put it in player.pl and use it like this. Then every time a player completed an activity, you'd have the $activity_id and $task_id variables to play with.
Code:
sub EVENT_TASK_STAGE_COMPLETE {
quest::say("Yay!, I completed activity $activity_id of task $task_id");
}