Skip to content

Comment on Using Babel transforms to inject analytics code at build timeparent

Comments

The article seems to end before solving the original problem. You start out with a call to `analytics.track` and seem to just forget about it. Do you mind sharing examples of how to disambiguate the sender / event args in `captureTouchablePress` into something meaningful?

Good point, we didn’t really get into that part of the story.

At Heap, we have a concept of a “virtual event”, in which there’s a raw event data set, and then you (the Heap customer) would “define” events on this raw data through our UI. The resulting data set is what you’d normally get from traditional `analytics.track` code, except it would be retroactive to the point when you installed Heap, you can change/delete/create events (without losing the underlying data), and you wouldn’t have actually written any additional tracking code.

We have some material on virtual events on https://heap.io/product/virtual-events, and the code that extracts the raw events from these interactions can be found at https://github.com/heap/react-native-heap/blob/c2dae7ef2442a... (the function our babel plugin hooks into) and https://github.com/heap/react-native-heap/blob/c2dae7ef2442a... (the function that creates most of the raw event we send to Heap)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.