The Heap integration with LaunchDarkly allows you to send data from LaunchDarkly into Heap. You’ll need to attach LaunchDarkly’s user key and feature flags as user and event properties in Heap.
If you’re using addEventProperties
, be sure to double-check the length of the cookie—there is a max of 4kb for the props cookie and most servers have an 8kb cookie load limit. You can calculate the cookie size of passing all feature flags by in the browser console.
If you’re noticing none
values on your non-pageview events while doing your analysis in Heap, that’s a good sign that you need to call clearEventProperties
to ensure you’re under the browser cookie limit.
encodeURIComponent(JSON.stringify(ldclient.allFlags())).length
You can also add user flags as user properties.
// get LaunchDarkly user ID and send to Heap as user property
var ldUserId = ldclient.getUser().key
heap.addUserProperties({"ldUserId": ldUserId});
/ /get LaunchDarkly feature flags and attach as properties to all events
var ldProps = ldclient.allFlags();
heap.addEventProperties(ldProps);
It’s also important to note that the LaunchDarkly client initializes after Heap does, so those flags that we add are best analyzed with non-pageview events.