Zephr User Guide

SDK Output Types

25 views 0

In your SDK feature, you can use an output type to define the outcome that is displayed on your site. Once created in the Developer Interface, a related Outcome decision node is available from the Outcomes segment title in the decision bar above the rules canvas.

Note: Each SDK feature can use only one output type.

You can create the following output types:

  • Component

    A Component output type uses HTML to define the outcome that is displayed on your site.

    You can add multiple Component output types in the Developer Interface.

  • Enum

    An Enum output type uses a constant value to define the outcome that is displayed on your site.

    You can add multiple Enum output types in the Developer Interface.

  • String

    A String output type uses a string that is displayed on your site.

    You can add a single String output type in the Developer Interface.

    When you add the String Output decision node to your rules canvas, the Output String dialog box displays, as illustrated below:

    “Output

    To define the string to display complete the following steps:

    1. Enter the string as you want it to display in the Output text box
    2. Select the Save button to save the string and return to the rules canvas. Selecting the Cancel button closes the Output String dialog box and returns you to the rules canvas; the String Output decision node is not included on the rules canvas

    You can use the String decision node multiple times in your rule. Each time you add it to the rules canvas, you can define a different string as described above.

  • Number

    A Number output type uses a number that is displayed on your site.

    You can add a single Number output type in the Developer Interface.

    When you add the Number Output decision node to your rules canvas, the Output Number dialog box displays, as illustrated below:

    “Output

    To define the number to display complete the following steps:

    1. Enter the number as you want it to display in the Output text box
    2. Select the Save button to save the number and return to the rules canvas. Selecting the Cancel button closes the Output Number dialog box and returns you to the rules canvas; the Number Output decision node is not included on the rules canvas

    You can use the Number Output decision node multiple times in your rule. Each time you add it to the rules canvas, you can define a different number as described above.

  • Output Type Comparison

    The following table provides a summary of the application and limitations of each output type:

    Component Enum String Number
    Pros
    • Add custom HTML
    • Simplify reuse of code components
    • Use less processing time
    • Consistent responses
    • Ease of debugging
    • Avoid hardcoding of messages
    • Simple to define and update
    • Simple to define and update
    Cons
    • Knowledge of HTML required
    • If referencing an external UI component, you must know the source URL and it must be available
    • Can only use constant values
    • Your code must be able to understand and process the Enum value
    • No additional formatting can be applied
    • Your code must be able to understand and process the strings
    • Your code must be able to understand and process the numbers
    Example Use
    • Customise fonts, colour, size and positioning using HTML
    • Including an external UI component in your page
  • Allow or deny access to the feature when using your own CDN
  • Specify the user experience
  • Return a value that is recognised by your code
    • Display a message in the appropriate language
    • Return a code that is recognised by your software
    • Return a numerical code that is recognised by your software