#
initializeMixpanel
Initialize Mixpanel with Workleap's default settings.
#
Reference
initializeMixpanel(productId, envOrTrackingApiBaseUrl, options?: { verbose });
#
Parameters
productId
: The product id.envOrTrackingApiBaseUrl
: The environment to get the navigation url from or a base URL.options
: An optional object literal of options:trackingEndpoint
: An optional tracking endpoint.verbose
: If nologgers
are configured, verbose mode will automatically send logs to the console. In some cases, enabling verbose mode also produces additional debug information.loggers
: An optional array ofRootLogger
instances.
#
Environments
Supported environments are:
production
staging
development
local
msw
#
Usage
#
Initialize with a predefined environment
Mixpanel can be initialized for any of the following predefined environments:
production
staging
development
local
msw
import { initializeMixpanel } from "@workleap/mixpanel";
initializeMixpanel("wlp", "development");
#
Initialize with a base url
import { initializeMixpanel } from "@workleap/mixpanel";
initializeMixpanel("wlp", "https://my-tracking-api");
#
Use a custom tracking endpoint
import { initializeMixpanel } from "@workleap/mixpanel";
initializeMixpanel("wlp", "https://my-tracking-api", {
trackingEndpoint: "custom/tracking/track"
});
#
Verbose mode
import { initializeMixpanel } from "@workleap/mixpanel";
initializeMixpanel("wlp", "development", {
verbose: true
});
#
Loggers
import { initializeMixpanel } from "@workleap/mixpanel";
import { LogRocketLogger } from "@workleap/logrocket";
import { BrowserConsoleLogger, LogLevel } from "@workleap/logging";
initializeMixpanel("wlp", "development", {
loggers: [new BrowserConsoleLogger(), new LogRocketLogger({ logLevel: LogLevel.information })]
});