You should be able to define a global function inside of the extension as long as you aren't using the "var" keyword in front of the function declaration.
If you use:
var logtest = function() {
console.log('test');
}
The function object will be created with the current execution scope, so only accessible from the utag.handler object (with might be within another execution scope as well instead of being globally accessible, I'm just going off of the code presented here.)
If you use:
logtest = function() {
console.log('test');
}
Then the lack of the "var" keyword will cause Javascript to create your function at the global object scope, unless there is something else going on with the Tealium extension code that I'm not aware of, but standard Javascript typically works this way.
With this question you are dipping into something that has confused a lot of people over the years and led to a lot of bugs and made a lot of problems difficult to debug. There are a couple of good answers to a similar question over at StackOverflow that go deeper into the technicalities if you are interested: http://stackoverflow.com/questions/1470488/difference-between-using-var-and-not-using-var-in-javascript
Also, you also shouldn't have to assign your function to an object that is at the global scope, like "window". A lot of people consider it a bad idea to do so, and there is a good blog post detailing why here: http://perfectionkills.com/extending-built-in-native-objects-evil-or-not/
... View more