Functions Overview

Functions let you create your own sources and destinations directly within your workspace to bring new types of data into Segment and send data to new tools with just a few lines of JavaScript - no additional infrastructure required.

Functions is available to all customer plan types with a free allotment of usage hours. Read more about Functions usage limits, or see your workspace’s Functions usage stats.

An image illustrating source functions and destination functions in a Segment workspace

What can you do with Functions?

Functions can help you bring external data into Segment (Source functions) and send data in Segment out to external destinations (Destination functions). Use Insert functions to transform data before it reaches your downstream destinations. Functions are scoped to your specific workspace. If you’re a technology partner and want to build a new integration and publish it in Segment’s catalog, see the Developer Center documentation.

Source functions

Source functions receive external data from a webhook and can create Segment events, objects, or both. Source functions have access to the full power of JavaScript so you can validate and transform the incoming data and even make external API requests to annotate your data.

Use cases:

  • Ingest data into Segment from a source that’s unavailable in the catalog
  • Transform or reject data before it’s received by Segment
  • Enrich incoming data using external APIs

Learn more about source functions.

Destination functions

Destination functions can take events from a Segment source, transform the events, and deliver them to external APIs. Destination functions can make arbitrary requests to annotate data, as well.

Use cases:

  • Send data from Segment to a service that’s unavailable in the catalog
  • Transform data before sending it downstream
  • Enrich outgoing data using external APIs

Learn more about destination functions.

Destination insert functions

Destination insert functions help you enrich your data with code before you send it to downstream destinations.

Use cases:

  • Implement custom logic and enrich data with third party sources
  • Transform outgoing data with advanced filtration and computation
  • Ensure data compliance by performing tokenisation, encryption, or decryption before sending data downstream

To learn more, visit destination insert functions.

This page was last modified: 21 Sep 2023



Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account