Support emitting analytical events from xblocks running in the LMS

XBlocks can and should use the "publish" method provided by the runtime to emit analytical events. In theory we could now start replacing calls to track_function with calls to publish, however, that migration is not handled by this change.

Fixes: AN-789
Merge pull request #3089 from mulby/gabe/publish

Support emitting analytical events from xblocks running in the LMS