This is an expert concept
The power behind scriptlets is that you can write code for advanced, custom logic on your pages, store it centrally then plug it into creatives as needed!
1. Add Scriptlet(s) to your ion console
You'll create your scriptlet outside of ion and then add it to the library.
a. Navigate to Libraries > Server Scriptlets
b. Click on +category and label a scriptlet category
c. Click on +Scriptlet and label the scriptlet
2. Use rules to run your scriptlet(s) on your ion pages
a. Navigate into the page you want your script to run on
b. Click on the “rules” button in the Page tab of your creative studio if you want the script to run on page load. If you would like the scriptlet to run on form submission, click the form and then open the rules editor from within the Content tab of your creative studio.
c. Add a rule condition to trigger the Scriptlet. If you want the script to run unconditionally upon page load or form submit, select “No conditions required”.
d. Add the action labeled “Run server scriptlet” and select the script from the drop-down to the right.
e. To base action(s) from the scriptlet’s result(s), add a new rule with the condition being “Server scriptlet result”, select the scriptlet and input the result value.
f. Add an action to trigger based on the scriptlet’s result value.
Let’s say you added a scriptlet to your console that calculates the respondent’s age based on a birth date value they input on an ion form. You would run the scriptlet using form-level rules. You could drive respondents under the age of eighteen, for example, to a page that explains they are not qualified to register.
Here’s an example of what your rules might look like to accomplish this:
Condition: No conditions required
Action: Run server scriptlet - Age Calculation
Condition: Server scriptlet result - Age Calculation - less than – 19
Action: Go to next page – “Not qualified to register”
We've attached a server scriptlet to this post. This scriptlet identifies if the respondent is on a smart phone and assigns a true/false value accordingly. Using rules, you can run the scriptlet and redirect respondents with a "true" value to a mobile-optimized page. The scriptlet also saves the smart phone type into a data collection field and tags the respondent, giving you heightened visibility into the devices your smart phone audience uses.
Please feel free to contact your account manager for support if you plan to leverage this powerful feature.