Heap to JustAnalytics: 7-Step Migration for Product Events
GuidesDecember 2, 202612 min read

Heap to JustAnalytics: 7-Step Migration for Product Events

Thousands of autocaptured Heap events, a few dozen that matter. Migration playbook inside.

Heap prices by sessions. Once a site passes its session thresholds, the bill climbs quickly. For a small team with a few active dashboards, that is hard to justify.

The kicker: most teams analyze only a few dozen events regularly. The rest of an autocaptured data set sits in Heap's data lake as dead weight. Clicks on elements nobody queries, form field interactions nobody segments by, and button taps on features that were removed long ago.

Autocapture sounds appealing: capture everything, define events later. For a while it works, because a conversion drop can be defined retroactively without any code changes.

But the magic fades. The data lake fills up with noise. You're paying for storage and sessions on interactions you'll never analyze. And because everything is captured, your legal team starts asking uncomfortable questions about GDPR compliance and what exactly you're logging from those form fields.

Explicit event tracking is the alternative. This is the playbook.

How to audit your Heap usage, map the events that matter, and migrate them as first-party events into JustAnalytics. You'll lose retro-definition. But you'll gain predictable costs, lighter payloads, and the kind of data governance that doesn't keep your DPO up at night.

Before you migrate: audit what you actually use

Heap's autocapture means you probably have thousands of events. Most are useless. The first step is figuring out which ones you'd actually miss.

Export your event frequency data:

  1. In Heap, go to Data → Events
  2. Filter to the last 90 days
  3. Sort by event count (descending)
  4. Export to CSV

You'll get a list of the events Heap has recorded and how often each one fired.

Cross-reference with your dashboards:

Open every saved chart, funnel, and retention analysis you've built. Write down each event that appears. These are your "must-maps" — the events your team actually uses for decisions.

Usually a short list of events drives every dashboard, funnel and retention curve. The rest of the autocaptured events are noise that rarely gets queried.

Categorize your must-maps:

Event TypeExampleHow to Migrate
Page views/pricing viewAutomatic — JustAnalytics tracks pageviews by default
Button clicks"Sign Up" buttonExplicit window.JustAnalytics.track("signup_clicked")
Form submissionsLead form submitExplicit event on submit handler
Custom eventsTrial startedAlready explicit — port the code
Retro-defined events"Clicked any pricing CTA"Requires decision: define explicitly or drop

The retro-defined events are the tricky ones. Heap lets you define an event such as a click on anything in the pricing hero section after the fact, by targeting CSS selectors. With explicit tracking, you need to decide upfront what to capture. Sometimes the answer is that you don't actually need that granularity, and that's fine.

Step 1: Document your Heap event definitions

For each must-map event, document exactly how Heap defines it. You'll need this to rebuild the equivalent explicit tracking.

For autocaptured clicks:

Open the event in Heap's visual labeling tool. Note:

  • Target element (CSS selector or visual identifier)
  • Page URL pattern
  • Any hierarchy/containment rules

For retro-defined events:

Screenshot the definition. A Heap event definition holds logic such as a click on any element matching .cta-button on pages containing /pricing. You need to translate this to explicit code.

For custom events:

Find the existing heap.track() calls in your codebase:

# Find existing Heap custom events
grep -r "heap.track" --include="*.js" --include="*.ts" --include="*.tsx" src/

These are the easiest — you're already instrumenting explicitly. The migration is mostly find-and-replace.

Step 2: Install JustAnalytics alongside Heap

Run both systems in parallel for 2-4 weeks. Don't cut over cold: without an overlap, you have nothing to check the new numbers against.

Add the JustAnalytics script to your site:

<script defer src="https://justanalytics.app/tracker.js"></script>

Copy the exact snippet, with your site ID, from your JustAnalytics dashboard. There is no browser npm package; the browser side loads from the script tag. The error-tracking script (monitor.js) is a separate include, so add it if you want errors too.

At this point, you're capturing pageviews. Custom events come next. For a framework example (Next.js), see our GA4 migration guide.

Step 3: Port your custom events

Start with the events you're already tracking explicitly via heap.track(). These map directly.

Heap:

heap.track("Trial Started", {
  plan: "pro",
  source: "pricing_page",
});

JustAnalytics:

window.JustAnalytics?.track("trial_started", {
  plan: "pro",
  source: "pricing_page",
});

Same pattern. The syntax is window.JustAnalytics.track(eventName, properties) instead of heap.track(eventName, properties). Easy.

For React apps with hooks:

// Before: Heap
import { useEffect } from "react";

useEffect(() => {
  if (trialActivated) {
    window.heap?.track("Trial Started", { plan });
  }
}, [trialActivated, plan]);

// After: JustAnalytics
useEffect(() => {
  if (trialActivated) {
    window.JustAnalytics?.track("trial_started", { plan });
  }
}, [trialActivated, plan]);

Run through your codebase and port each heap.track call. It's tedious but straightforward.

Step 4: Replace autocaptured clicks with explicit events

This is where explicit tracking diverges from autocapture. Instead of capturing every click and defining events later, you instrument the specific interactions that matter.

Identify click events in your must-map list. For each one:

  1. Find the component in your codebase
  2. Add an explicit event on click
  3. Verify it fires in JustAnalytics

Example — tracking CTA clicks that Heap autocaptured:

// Button component with explicit tracking
function PricingCTA({ plan }: { plan: string }) {
  const handleClick = () => {
    window.JustAnalytics?.track("pricing_cta_clicked", {
      plan,
      location: "hero",
    });
    // ... rest of click handling
  };

  return (
    <button onClick={handleClick}>
      Start Free Trial
    </button>
  );
}

Yes, this is more code than Heap's capture-everything approach. That's the tradeoff. But you know exactly what you're tracking, the event names are meaningful, and you're not accidentally capturing PII from adjacent form fields.

Common gotcha: Heap's autocapture often groups clicks by CSS class. If you had a retro-defined event for clicks on any .upgrade-button, you need to instrument each instance. Most teams use a shared tracking utility:

// utils/tracking.ts
export function trackClick(eventName: string, properties?: Record<string, unknown>) {
  window.JustAnalytics?.track(eventName, properties);
}

// Usage across components
<button onClick={() => trackClick("upgrade_clicked", { source: "sidebar" })}>
  Upgrade
</button>

Step 5: Rebuild funnels with explicit events

Heap funnels work on any autocaptured or defined event. JustAnalytics funnels work on events you explicitly track. The mechanics are similar once your events are flowing.

Map your existing funnels:

Funnel StageHeap EventJustAnalytics Event
LandingPageview: /homeAutomatic pageview
Pricing viewedPageview: /pricingAutomatic pageview
CTA clickedAutocaptured clickpricing_cta_clicked
Signup startedSignup Startedsignup_started
Trial activatedTrial Startedtrial_started

In JustAnalytics, build a conversion funnel (a Pro plan feature) with one stage per row of that table, using the same event names you instrumented.

The difference from Heap is that you're working with events you intentionally captured rather than sifting through autocaptured noise.

Step 6: Parallel validation

With both systems running, validate data parity on your key metrics.

What to compare weekly:

  1. Total pageviews — Should be within 5-10%. JustAnalytics is cookieless by default, and the two tools count sessions and bots differently, so expect some gap in either direction.
  2. Custom event counts — Should match closely if instrumentation is correct. A 20%+ delta means you missed an event trigger.
  3. Funnel conversion rates — The percentages matter more than absolute numbers. Rates should track.

Create a simple comparison sheet (these numbers are made up, to show the shape):

MetricHeapJustAnalyticsDelta
Pageviews (week of Aug 1)12,34011,890-3.6%
trial_started events8991+2.2%
Signup funnel conversion4.2%4.1%-0.1pp

If deltas are stable week-over-week, you're ready to cut. If they swing wildly, you have a tracking gap to debug.

Common validation issues:

  • Event firing twice — React strict mode in development calls effects twice. Use production builds for validation.
  • Missing events on specific pages — Check that the JustAnalytics script loads on all routes. SPAs sometimes miss script injection on client-side navigation.
  • User identification drift — If you call heap.identify(), set the same identifier as a user property with window.JustAnalytics.setUserProperty(key, value) at the same points.

The honest tradeoffs

This migration isn't pure upside. You lose real capabilities:

No retroactive event definition. This is Heap's killer feature. Something weird happens in your funnel, you define an event targeting that element, and you can analyze it across historical data. Gone. With explicit tracking, if you didn't instrument it, you don't have it.

For teams still in heavy exploration mode — unsure what to track, frequently discovering new metrics that matter — Heap's autocapture is genuinely useful. Teams past that phase have less use for it.

Upfront instrumentation work. Every event you want requires code. Heap's point-and-click event definition is faster for non-engineers. JustAnalytics assumes you're willing to write tracking calls. (If your product team defines events and your engineering team is bottlenecked, this friction is real.)

No visual event builder. Heap lets you click on elements in a screenshot-like UI to define events. JustAnalytics is code-first. For some teams, this is a feature — no ambiguity about what's being captured. For others, it's a workflow downgrade. If your PM defines most events and engineering is already slammed, expect friction during the transition.

What you gain

Predictable costs. JustAnalytics Pro is $49/month (or $39/month billed annually) for 1M events a month and up to 5 sites. The Free plan covers 1 site and 100K events a month. Pricing is per plan, not per session tier. Heap's pricing gets expensive fast once you pass their session thresholds.

Privacy-clean defaults. Explicit tracking means you capture only what you instrument. No accidental form field logging, no autocaptured input values, no "wait, did we just store credit card numbers in our analytics?" panic. Cookieless by default, GDPR-compliant without gymnastics.

Observability beyond analytics. JustAnalytics bundles error tracking, APM, session replay, uptime monitoring, and structured logs. Heap doesn't cover error tracking, APM, uptime or logs, so you're probably running Sentry or Datadog alongside it. Post-migration, that's one fewer vendor (or several, if you go all-in on consolidation). Our observability consolidation checklist covers the full stack reduction.

Lighter payload. The JustAnalytics script is under 5KB. Check Heap's own script weight in your network tab and compare; autocapture has to observe every DOM interaction, so don't be surprised if the gap is wide.

Step 7: Cut over

Once parallel validation looks stable (2-3 weeks of consistent deltas):

  1. Remove Heap's script from your site
  2. Remove heap.track() calls from your codebase
  3. Update your privacy policy
  4. Export any historical reports you need from Heap's dashboard (they vanish when your contract ends)
  5. Cancel the Heap subscription

Don't skip the export. Heap historical data doesn't transfer. If you have annual comparison reports, funnel screenshots for investor decks, or retention curves you reference — download them as CSV or screenshot them. Once you cancel, that data is gone.

After migration

You'll notice the silence first. No session thresholds to watch. No autocapture bloat. Events coming in are events you intended to track.

The Heap-to-explicit-tracking shift feels like a downgrade for the first week. You'll miss the retroactive flexibility at least once when something weird happens and you wish you could just define an event after the fact.

But after a month? When your analytics dashboard shows exactly what you instrumented and nothing else? The clarity is worth it.

A few dozen events that matter beat thousands you'll never query.

Frequently Asked Questions

How do I find which Heap autocaptured events actually matter before migrating?

Go to Heap's Data → Events, sort by frequency over the past 90 days, and export the top 100. Cross-reference with your saved charts and funnels — any event that appears in a dashboard you check weekly is a must-map. The rest are noise you rarely query.

Will I lose Heap historical data when I cancel?

Yes. Heap data stays in Heap until your contract ends. Export charts to CSV, screenshot key funnels, and document your retro-defined event definitions before canceling. JustAnalytics starts fresh from installation — there's no import path for Heap's autocaptured data model.

Can JustAnalytics do retroactive event definition like Heap?

No. Heap autocaptures interactions and lets you define events retroactively; in JustAnalytics, a custom event exists only if you track it explicitly. You trade retroactive flexibility for predictable data, smaller payloads, and GDPR-friendly defaults. If you rely heavily on retro-defining events after the fact, this is a workflow change you need to plan for.

Is autocapture better than explicit event tracking?

Depends on your team's discipline. Autocapture is powerful for exploration when you're not sure what to measure yet — you capture everything and define later. But it creates data bloat, privacy risk (capturing form inputs you didn't intend to), and makes governance hard. Explicit tracking requires upfront planning but produces cleaner data. Teams past the early exploration phase usually prefer explicit.


Try JustAnalytics

All-in-one observability in one under-5KB script: cookieless analytics + error tracking + APM + session replay + uptime + structured logs. Replaces GA4 + Sentry + Datadog + Pingdom + LogRocket. Free tier (100K events/mo), Pro $49/month ($39 annual).

Start free → · AI Command Center MCP

JP
JustAnalytics Platform TeamContributor

Author at JustAnalytics.

Related posts