When trying to emit code for a 3rd party javascript library, using Script.Literal will work but usually should be avoided. The whole point of using Script# is so you get compiler support, and easy refactoring.
I would recommend creating some new classes in your Script# library or even a separate Script# Import library if you plan to use Piwik in other projects.
The key is to mark these classes with the attribute [Imported] - This attribute will prevent the creation of a js file for the classes but will give you all the strong typing and refactoring goodness that makes script# so wonderful.
I'm not sure what "Piwik" is but I'll assume it's a Singleton object in the javascript library.
Create the following two classes.
[Imported]//we don't want this to show up in the javascript source.
public sealed class Tracker
{
public void TrackElement()//this will write trackElement() in emitted js.
{
}
}
[Imported]//we don't want this to show up in the javascript source.
public static class Piwik
{
public static Tracker GetTracker(string item)//this becomes getTracker()
{
return null;
}
}
You'll now be able to write code like this in Script#
Tracker tracker = Piwik.GetTracker("whatever");//c#
It will emit javascript that looks like this.
var tracker = Piwik.getTracker('whatever');//javascript