Heap Destination

Destination Info
Connection Modes
Device-mode Cloud-mode
Web Web
Mobile Mobile
Server Server

Heap automatically captures every user interaction with no extra code. This includes clicks, taps, gestures, form submissions, page views, and more. The Heap Destination is open-source. You can browse the code on GitHub.

Getting Started

Before you start, make sure Heap supports the source type and connection mode you’ve chosen to implement. You can learn more about connection modes here.

Web Mobile Server
📱 Device-mode ⬜️ ⬜️
☁️ Cloud-mode
  1. From the Segment web app, click Catalog.
  2. Search for “Heap” in the Catalog, select it, and choose which of your sources to connect the destination to.
  3. In the destination settings, enter your Heap “App ID” into the connection settings.
  4. Remove Heap’s snippet from your page if you’re using Segment’s client-side Analytics.js library to load Heap. With the Analytics.js library, Segment asynchronously loads Heap’s JavaScript library onto your page. All native functionality of Heap, including auto-capturing of all events are available to you.


If you’re not familiar with the Segment Specs, take a look to understand what the Identify method does. An example call would look like:


When you call identify, Segment calls Heap’s identify method with the userId and traits you provide.

If one of your traits is of the date property type, we will convert it into an ISO string.


If you’re not familiar with the Segment Specs, take a look to understand what the Track method does. An example call would look like:

analytics.track('Clicked Button');

When you call track from analytics.js, Segment calls Heap’s track function with the same parameters. Calling track from one of Segment’s mobile SDKs or server-side sources records a Heap Custom Event with the same event name and properties.

If one of your properties is of the date property type, we will convert it into an ISO string.


Anonymous traffic not showing up from server-side source

Ensure that you are specifying a user_id in your event calls. The Heap API will reject any server-side events without a user_id.

Nested Objects and Arrays

Heap does not accept nested properties, so we will flatten and stringify them before sending to Heap. For example:

 analytics.track('Signed Up', {
   foo: {
     bar: {
       cheese: 'american',
       prop: [1, 2, 3],
       products: [{"A": "Jello"}, {"B": "Peanut"}]

The properties would be sent as:

foo.bar.cheese: 'american'
foo.bar.prop: '[1,2,3]'
foo.bar.products: "[{'A': 'Jello'},{'B': 'Peanut'}]"


You can send computed traits and audiences generated using Engage to this destination as a user property. To learn more about Engage, schedule a demo.

For user-property destinations, an identify call is sent to the destination for each user being added and removed. The property name is the snake_cased version of the audience name, with a true/false value to indicate membership. For example, when a user first completes an order in the last 30 days, Engage sends an Identify call with the property order_completed_last_30days: true. When the user no longer satisfies this condition (for example, it’s been more than 30 days since their last order), Engage sets that value to false.

When you first create an audience, Engage sends an Identify call for every user in that audience. Later audience syncs only send updates for users whose membership has changed since the last sync.

Real-time to batch destination sync frequency

Real-time audience syncs to Heap may take six or more hours for the initial sync to complete. Upon completion, a sync frequency of two to three hours is expected.


Segment lets you change these destination settings from the Segment app without having to touch any code.

Setting Description
App ID
string. You can find the snippet containing your app ID in Heap’s QuickStart docs. It’s inside the heap.load('YOUR_APP_ID') function call.

This page was last modified: 06 Apr 2023

Get started with Segment

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