You can set a Context Variable in a TBB and use it in a Page Template, what you need to do is the following thing.
Instantiate the Context Variable (Page Template)
engine.PublishingContext.RenderContext.ContextVariables.Add("ContextVariable", string.Empty);
Set your context variable in a .NET TBB or C# Fragment (Component Template)
TcmUri linkId = new TcmUri("[Link ID]");
TcmUri templateId = new TcmUri("[RemoveSpecialCharactersFromTitle]");
engine.PublishingContext.RenderContext.ContextVariables["ContextVariable"] =
engine.RenderComponentPresentation(linkId, templateId);
Put the Context Variable in a Package Variable (Page Template)
stringvar variableconVar = engine.PublishingContext.RenderContext.ContextVariables["ContextVariable"].ToString();
package.PushItem("ContextVariable", package.CreateStringItem(ContentType.Html, variableconVar);
Use the package variable in your DWT (Page Template)
<a onclick="_gaq.push(['_trackEvent', '@@Links0.Metadata.ga_category@@',
'@@Links0.Metadata.ga_action@@', '@@ContextVariable@@']);"
tridion:href="@@Links0.Fields.link@@" target="_blank" class="button primary" >