
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
react-mixpanel-browser
Advanced tools
React hook for [mixpanel-browser](https://www.npmjs.com/package/mixpanel-browser).
Wrapper of mixpanel-browser for use in React apps.
Provides a Mixpanel
instance via the context API.
npm install --save react-mixpanel-browser
yarn add react-mixpanel-browser
MixpanelProvider
Wrap your application with the <MixpanelProvider />
component:
import { MixpanelProvider } from 'react-mixpanel-browser';
// [OPTIONAL] Set your Mixpanel token. It is up to you how this token is obtained (e.g. via env
// var). If `token` is `undefined` or otherwise falsey then `useMixpanel()` will return
// `undefined` which can be useful for environments where Mixpanel integration is not desired.
const MIXPANEL_TOKEN = 'MyToken';
// [OPTIONAL] Custom options to pass to `mixpanel.init()`.
const MIXPANEL_CONFIG = {
// track_pageview: true, // Set to `false` by default
};
const App = (props) => (
<MixpanelProvider config={MIXPANEL_CONFIG} token={MIXPANEL_TOKEN}>
{/* ... */}
</MixpanelProvider>
);
export default App;
useMixpanel()
Call the useMixpanel()
hook when you need to interact with Mixpanel:
import { useMixpanel } from 'react-mixpanel-browser';
const Dashboard = (props) => {
const mixpanel = useMixpanel();
useEffect(() => {
if (!mixpanel) {
// Will be `undefined` if a token was not provided to `MixpanelProvider`
return;
}
mixpanel.track('DashboadView', {
my_custom_prop: 'foo',
});
}, [mixpanel]);
return <div>Dashboard</div>;
};
export default Dashboard;
FAQs
React hook for [mixpanel-browser](https://www.npmjs.com/package/mixpanel-browser).
The npm package react-mixpanel-browser receives a total of 2,242 weekly downloads. As such, react-mixpanel-browser popularity was classified as popular.
We found that react-mixpanel-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.