How to define a JavaScript variable for the URL action

So is setTemplateTag the recommended way for exporting script results for use elsewhere?