--- title: "Plugin Script Structure" slug: "plugin-script-structure" updated: 2023-11-15T14:22:49Z published: 2023-11-15T14:22:49Z canonical: "docs.datajet.app/plugin-script-structure" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # Plugin Script Structure Plugins (or Extensions) are DataJet JSON scripts that sit in the DataJet plugins folder and have a wrapper around a standard Script Editor script. The wrapper contains the following elements: | Key | Value(s) | Description | | --- | --- | --- | | type | "PluginType" | - "DJPLUGIN" - DataJet Plugin | | version | versionNo | | | help | "Help Text" | Paragraph providing brief explanation of how to use the Plugin or Extension | | helpURL | "URL to detailed help source" | | | name | "Plugin Name" | | | title | "Plugin Menu Display Text" | Menu item text | | classification | "Desktop Menu Location" | Plugin Menu Location. Can be: - "ANALYTICS" - "ENGINEERING" - "MODELLING" | | "menuGroup | "Desktop Sub-menu" | Menu sub-group. On ANALYTICS and ENGINEERING will appear under the menu item "Extensions" On Modelling, will be the Sub Menu heading | | uivariables[] | [ { "variable": "%VARIABLE_NAME%", "name": "Variable Name", "type": "Variable type", "description": "Variable display description" *"default": {datasetelement}* *"options":{"opt1", "opt2", "opt3"},* } ] | - Convention is to use %XXXXX% for variable names - Supported types: - string - Table - Field - integer - dataset - choice - "default" only required for type "dataset" - "options" only required for type "choice" | | script [] | [ScriptEditorScript] | script should contain a series of well-formed script-editor methods | | onView {} | [ { "action": "onView action", "report": "ReportName", } ] | - Supported actions: - OpenReport | ```json { "type": "DJPLUGIN", "version": 1, "help": "Recency Frequency Value Model\r\n\r\nUse Filter to restrict modeling universe", "helpURL": "https://en.wikipedia.org/wiki/RFM_(market_research)", "name": "RFM (Filtered)", "title": "RFM (Filtered)", "classification": "ANALYTICS", "menuGroup": "RFM", "uivariables": [ { "variable": "%MODELNO%", "name": "Model Name", "type": "string", "description": "Name for this models's results" }, { "variable": "%STABLE%", "name": "Table", "type": "Table", "description": "Table to Model" }, { "variable": "%RECENCY%", "name": "Recency Field", "type": "Field", "description": "Field that measures recency" }, { "variable": "%FREQUENCY%", "name": "Frequency Field", "type": "Field", "description": "Field that measures frequency" }, { "variable": "%VALUE%", "name": "Value Field", "type": "Field", "description": "Field that measures value" }, { "variable": "%DECILES%", "name": "Quantile Size", "type": "integer", "description": "Size of quantile for combined-dimension (5-10)" }, { "variable": "%FILTER%", "name": "Filter", "type": "dataset", "description": "Filter", "default": { "logic": "or", "name": "%STABLE%", "strict": true, "set": [ { "logic": "or", "stype": "TABLE", "entity": "%STABLE%" } ] } } ], "script": [ ], "onView": [ { "action": "OpenReport", "report": "%MODELNO%-RFV_REPORT" } ] } ``` uivariable examples; ```json { "variable": "%SOURCETABLE%", "name": "Table", "type": "Table", "description": "Table containing fields to cluster" }, { "variable": "%SFIELD1%", "name": "First Field", "type": "Field", "description": "First field in cluster" }, { "variable": "%CLUSTERNAME%", "name": "Cluster Field", "type": "string", "description": "Name of field to contain cluster result" }, { "variable": "%NCLUSTERS%", "name": "Clusters", "type": "choice", "options": [ "2", "3", "4", "5", "6", "7", "8", "9" ], "description": "Number of Clusters" }, { "variable": "%CLUSTERS%", "name": "Clusters", "type": "integer", "description": "Number of Clusters (2-9)" }, { "variable": "%FILTER%", "name": "Filter", "type": "dataset", "description": "Filter", "default": { "logic": "or", "name": "%STABLE%", "strict": true, "set": [ { "logic": "or", "stype": "TABLE", "entity": "%STABLE%" } ] } ```