Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@jitsu/jitsu-react
Advanced tools
npm install --save @jitsu/jitsu-react
To setup Jitsu-React library you need to add JitsuProvider
component close to the root level of your app:
import React, { Component } from 'react'
import { JitsuProvider } from "@jitsu/jitsu-react";
class Example extends Component {
render() {
return <JitsuProvider options={{ host: "https://mysiteid.d.jitsu.com" }} >
<App />
</JitsuProvider>
}
}
Then use useJitsu
hook in components where you want to track events.
import * as React from "react";
import { useJitsu } from "@jitsu/jitsu-react";
export default function App() {
const { analytics } = useJitsu();
// manually track page view
analytics.page();
return (
<div>
...
</div>
);
}
To enable auto page tracking with react-router, pass useLocation
hook from react-router-dom
to autoPageTracking
option:
import * as React from "react";
import { useLocation } from "react-router-dom";
import { useJitsu } from "@jitsu/jitsu-react";
export default function App() {
useJitsu({
// Enable auto page tracking with react-router
autoPageTracking: {
reactRouter: useLocation
},
});
return (
<div>
...
</div>
);
}
To enable auto page tracking with Next.JS router, pass useRouter
hook from next/router
to autoPageTracking
option:
import * as React from "react";
import { useRouter } from "next/router";
import { useJitsu } from "@jitsu/jitsu-react";
export default function App() {
useJitsu({
// Enable auto page tracking with Next.JS router
autoPageTracking: {
nextjsRouter: useRouter
},
});
return (
<div>
...
</div>
);
}
Please check ../../examples/react-app
for a full example of how to automatically send identify
event when user logins on your site.
Partial snippet:
export default function App() {
const user = useUser();
useJitsu({
autoPageTracking: {
reactRouter: useLocation,
before: function (analytics) {
if (user && user.id) {
analytics.identify(user.id, { name: user.name, email: user.email });
}
},
beforeDeps: [user],
},
});
return (
<div>
...
</div>
);
}
FAQs
Unknown package
The npm package @jitsu/jitsu-react receives a total of 1,159 weekly downloads. As such, @jitsu/jitsu-react popularity was classified as popular.
We found that @jitsu/jitsu-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.