Back

Creating a Function

Follow these steps to create a function:

  1. Go to Server-SideFunctions > Overview.
  2. Click +Add Function.
  3. Enter a name for the function.
  4. Select a trigger: Processed Event or Processed Visitor, then click Continue.
  5. Select an event feed or an audience, depending on the selected trigger, then click Continue.
    Commented example code is displayed. You can modify this code, or replace it with your own function code. For more information on writing functions, see Writing Functions.
  6. After testing the function, click the Configuration tab, change the Status to ON, and click Done.
  7. Click Save/Publish.
    The function is not saved, and cannot be triggered, until you save and publish. If you edit a function later on, make sure you save and publish for the changes to take effect.

Adding Authentication for a Service Provider

Instructions for adding an authentication varying depending on the service provider.  For more information, see Adding an Authentication to a Function.

Deleting a Function

To delete a function from the list of functions, follow these steps:
  1. Click the menu for the function and then click Delete.
  2. In the Delete Function pop-up, click Delete.
  3. Click Save/Publish.

To delete a function from the code editor, follow these steps:

  1. Click Delete in the function title bar.
  2. In the Delete Function pop-up, click Delete.
  3. Click Save/Publish.

Testing a Function

When you execute a function in the Test tab, the test payload shown is sent to the function. You can get test data from your website and save it to use as a test payload. For more information on getting test data from your website, see Writing Functions.

Use the following steps to test a function:

  1. In the code editor, click the Test tab.
    A Test Payload containing example data for testing the function is shown, which can be modified as needed.
  2. To load a saved Test Payload, click Load Saved Payload and select a test payload from the list.
  3. To run the function, click Run Test.
    The execution result is shown below Test Input. Execution Output and Test Logs are shown below the result.
  4. To view a log, click Test Logs, then click a log in the list.

Saving a Test Payload

You can save a maximum of ten test payloads for testing a function. For information on getting test data from your website to use as a test payload, see Writing Functions.

Use the following steps to save a test payload:

  1. To save a Test Payload for future use, click Save As.
    You can save a maximum of ten test payloads.
  2. Enter a name for the test payload and click Save As.
  3. Click Apply.
  4. Click Save/Publish.

Setting a Saved Test Payload as the Default

  1. Click Load Saved Payload and select a payload.
  2. Click the payload menu and select Set Default.
  3. Click Apply.
  4. Click Save/Publish.

Deleting a Saved Test Payload

You may need to delete a test payload if you have already saved the maximum of ten test payloads, and need to save another. Follow these steps to delete a test payload:

  1. Click the payload menu and then click Delete.

    Use caution when deleting saved test payloads. There is no confirmation dialog.

  2. Click Apply.
  3. Click Save/Publish.

View Function Statistics

After you have set the status of a function to On, you can view the following statistics about the function execution:

  • Invocations 
  • Execution Time
  • Errors

You can view statistics for these time frames:

  • Last hour
  • Last 12 hours
  • Last day
  • Last 7 days
  • Last 30 days

Follow these steps to view function statistics:

  1. Click a function in the list.
  2. Click the Monitoring tab to see the function statistics.

View Logs

Log files contain messages from the function, as well as any errors that occurred during execution.  Use the following steps to see log files for the past 24 hours.

  1. Click a function in the list.
  2. Click the Logs tab.

Additional Information

Public