Q:

Get the last goal triggered by the current visitor

Is there a way in c# to get the name of the last goal triggered by the current visitor? 
A simple conceptual example:
Bob visitors the homepage and clicks on a button (triggering a goal called "my button click"
Bob then fills out a contact form (triggering a goal called "contact form submitted")
Is there a good way in my back-end code (given I know Bob is current looking at the site) to get the fact that Bob's last triggered goal was "contact form submitted"? 
I figure if that's not possible, I might be able to store a custom field against the visitor when the goal is triggered - but that seems unnecessary as the information should already be in the Mongo DB? 
Solution is on Sitecore 7.5. 

A:

You can use the tracker api to retrieve the latest Page Event:
    Tracker. Current. Session. Interaction. Pages. SelectMany(x=>x. PageEvents)
            .OrderByDescending(x=>x. Timestamp).FirstOrDefault()

This is not tested code, let me know whether it works for you. 
Update:
If you want to get only goals, they can be filtered by adding this LINQ condition:
.Where(x => x.IsGoal)

