# Migrate to v2.0

This new version introduces two correlation ids, telemetryId and deviceId, to help unify and correlate data across LogRocket, Honeycomb and Mixpanel and a new automatic enrichment of the events with the LogRocket session url if the LogRocket instrumentation is registered.

To support these new automations, a new initializeMixpanel function has been introduced. This setup function should be called only once per load, during the application's bootstrap phase.

# Breaking changes

Before:

import { createTrackingFunction } from "@workleap/mixpanel";

const track = createTrackingFunction("wlp", "development", {
    targetProductId: "ov"
});

track("ButtonClicked", { "Trigger": "ChangePlan", "Location": "Header" });

After:

import { initializeMixpanel, createTrackingFunction } from "@workleap/mixpanel";

// Must be executed once.
initializeMixpanel("wlp", "development");

...

const track = createTrackingFunction();

track("ButtonClicked", { "Trigger": "ChangePlan", "Location": "Header" });

Or for a React application:

import { initializeMixpanel } from "@workleap/mixpanel";
import { useTrackingFunction } from "@workleap/mixpanel/react";

// Must be executed once.
initializeMixpanel("wlp", "development");

...

const track = useTrackingFunction();

track("ButtonClicked", { "Trigger": "ChangePlan", "Location": "Header" });

# Improvements

# Correlation ids

To help unify and correlate data across LogRocket, Honeycomb, and Mixpanel, the initializeMixpanel function now automatically adds two correlation ids as attributes to every event:

  • telemetryId is a new identifier that represents a single application load.
  • deviceId is an identifier that represents a single device across multiple loads.

# Session URL enrichment

A built-in integration now automatically allows other telemetry libraries to include the LogRocket session replay URL in their traces.

Once the LogRocket session URL is retrieved, each event is enriched with an LogRocket Session Url property:

Enrichment example
Enrichment example

# Super properties

You can now use a new function to add super properties, global event properties that are defined once and automatically included with all events:

import { setSuperProperties } from "@workleap/mixpanel";

setSuperProperties({
    "User Id": "123"
});

# Migrate from v1.0

Follow these steps to migrate an existing application v1.0 to v2.0: