Advanced: Javascript Editor

Javascript window

Javascript Editor

The JavaScript Editor can be used to write any JavaScript. It is executed in the scope of the Custom Unit delivery as long as variables are defined with var, or in the $jp namespace.

The Jetpack Ad Platform provides a pre-scoped namespace variable called $jp. This variable has a list of convenience methods, and allows you to access modules directly. For example, the varname of a Button by default is the system title of the Button, so, the Button could be referenced using $jp.ButtonModule_2 in the JavaScript code. An event handler could choose to hide the module by calling $jp.ButtonModule_2.hide();

Note that module references are not ready until the Jetpack Creative triggers a “stageLoaded” event. So the call above to hide would fail until the ButtonModule_2 is ready to receive calls.

955

Using the Javascript window and $jp namespace variable.