Event based Atlas tracking

So I ran into this issue where there was absolutely no documentation on how to handle Atlas tracking on non-page-load events. Typically Atlas would provide a tracking sheet with code snippets that you can add to your page. This is all great except these drop in code snippets really only fire at page load and not on an event.

What I originally received:

To turn this into an event based tracking tag you will need to use JavaScript and add the following:

function fireAtlasActionTag(uniqueActionTagCode) {
var atlasJavascriptTag = document.createElement('script');
atlasJavascriptTag.type = 'text/javascript';
atlasJavascriptTag.src = 'http://view.atdmt.com/jaction/' + uniqueActionTagCode;

and finally to call the tracking tag: