This preview of pull request 1639 is meant for internal use only.

Heap Destination

Heap quick info

Heap accepts Track, and Identify calls. If you reference it in the Integrations object, call it “Heap”.

Heap accepts data in cloud-mode from all source types, and can accept data in device-mode from Analytics.js sources.

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.

This document was last updated on January 29, 2018. If you notice any gaps, out-dated information or simply want to leave some feedback to help us improve our documentation, let us know!

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. If you are using Heap using Segment’s client-side analytics.js library, we asynchronously load Heap’s Javascript library onto the page. As such, all native functionality of Heap, including auto-capturing of all events.

Identify

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:

analytics.identify('userId123');

When you call identify we call 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.

Track

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, we call Heap’s track function with exactly the same parameters. Calling track from one of our 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.

Troubleshooting

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'}]"

Personas

You can send computed traits and audiences generated using Segment Personas to this destination as a user property. To learn more about Personas, contact us for 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, Personas 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), Personas sets that value to false.

When you first create an audience, Personas 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.

Settings

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

App ID

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: 20 Oct 2020



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