{"_id":"@amna1408/react","_rev":"5-d3567b332df47143b022951ddff3ecc4","name":"@amna1408/react","description":"Usermaven JavaScript SDK for React","dist-tags":{"latest":"1.5.0"},"versions":{"1.4.18":{"name":"@amna1408/react","version":"1.4.18","author":{"name":"amna","email":"hello@usermaven.com"},"license":"MIT","_id":"@amna1408/react@1.4.18","homepage":"https://github.com/amna1408/usermaven-js#readme","bugs":{"url":"https://github.com/amna1408/usermaven-js/issues"},"dist":{"shasum":"d02fd89e011929fc1b09d0171a8c98ac9f09de6d","tarball":"https://registry.npmjs.org/@amna1408/react/-/react-1.4.18.tgz","fileCount":15,"integrity":"sha512-igIrH16pll747lGhp0ck5V6CX1H1UDsRoETncfwT/RcVoQCXZMYW/Ik6i8bbLPsDptYgZib+5e1LQnK7UeYjZg==","signatures":[{"sig":"MEUCIQDW+cObA20aqdsRFUVigU0EcopXhqf7ch/PUqT9par+DQIgOgQ/6fvwC+NZ26e+OAHqPSiuVMue6LQJipLmRYjPxnA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":117522},"main":"lib/index.js","module":"lib/index.es.js","gitHead":"68aac5cab44b4cadfb68d0dd3d9ca1c008b26a6f","private":false,"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","build":"rollup -c && tsc"},"typings":"lib/index.d.ts","_npmUser":{"name":"amna0125","email":"amnaasaeed14@gmail.com"},"repository":{"url":"git+https://github.com/amna1408/usermaven-js.git","type":"git","directory":"packages/react"},"_npmVersion":"10.7.0","description":"Usermaven JavaScript SDK for React","directories":{"lib":"lib"},"_nodeVersion":"20.14.0","dependencies":{"@amna1408/sdk-js":"^1.2.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"17.0.2","rollup":"^2.70.1","@types/react":"17.0.43","react-router":"6.2.2","@rollup/plugin-commonjs":"^21.0.2","@rollup/plugin-typescript":"^8.3.1","@rollup/plugin-node-resolve":"^13.1.4","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"react":"15.x || 16.x || 17.x || 18.x","react-router":"5.x || 6.x"},"_npmOperationalInternal":{"tmp":"tmp/react_1.4.18_1719229645888_0.44694118022626483","host":"s3://npm-registry-packages"}},"1.4.19":{"name":"@amna1408/react","version":"1.4.19","author":{"name":"amna","email":"hello@usermaven.com"},"license":"MIT","_id":"@amna1408/react@1.4.19","homepage":"https://github.com/amna1408/usermaven-js#readme","bugs":{"url":"https://github.com/amna1408/usermaven-js/issues"},"dist":{"shasum":"8c701e72fed29b75a6b6a794cc1d18ab5d23172e","tarball":"https://registry.npmjs.org/@amna1408/react/-/react-1.4.19.tgz","fileCount":15,"integrity":"sha512-D8ECh+XMmw6rJZ9cSKoyyvd9xEHzq6kJmUAATju0zvSZVNIBdvnfx9TQUwD5X+z+s9aRo3u5ZRXmEAx2R+Wxrw==","signatures":[{"sig":"MEUCIQDCaFmvRM4/D5t4qpZbhbA+PPm1x7Avq3yAGlSxxNbjCQIgTHPNVBvWUVyKVuOXONA63j6oZ2h0qm/EkosEanMzCco=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":117522},"main":"lib/index.js","module":"lib/index.es.js","gitHead":"1f1b7555b982cb25225a469728b5736113bea76b","private":false,"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","build":"rollup -c && tsc"},"typings":"lib/index.d.ts","_npmUser":{"name":"amna0125","email":"amnaasaeed14@gmail.com"},"repository":{"url":"git+https://github.com/amna1408/usermaven-js.git","type":"git","directory":"packages/react"},"_npmVersion":"10.7.0","description":"Usermaven JavaScript SDK for React","directories":{"lib":"lib"},"_nodeVersion":"20.14.0","dependencies":{"@amna1408/sdk-js":"^1.2.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"17.0.2","rollup":"^2.70.1","@types/react":"17.0.43","react-router":"6.2.2","@rollup/plugin-commonjs":"^21.0.2","@rollup/plugin-typescript":"^8.3.1","@rollup/plugin-node-resolve":"^13.1.4","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"react":"15.x || 16.x || 17.x || 18.x","react-router":"5.x || 6.x"},"_npmOperationalInternal":{"tmp":"tmp/react_1.4.19_1719230082825_0.6716725319729957","host":"s3://npm-registry-packages"}},"1.4.20":{"name":"@amna1408/react","version":"1.4.20","author":{"name":"amna","email":"hello@usermaven.com"},"license":"MIT","_id":"@amna1408/react@1.4.20","homepage":"https://github.com/amna1408/usermaven-js#readme","bugs":{"url":"https://github.com/amna1408/usermaven-js/issues"},"dist":{"shasum":"455b5c58eb5ab150f6d03ce7d1e7ce87f986a14d","tarball":"https://registry.npmjs.org/@amna1408/react/-/react-1.4.20.tgz","fileCount":15,"integrity":"sha512-tlT5IAyCoN+WYrhnGFPhVfQ37Z9RZp6YkwKIUPnVktDy2sUcc+l5a9x0i13ww7asjjoIHKfZBgIg1Nx4/Oc5Aw==","signatures":[{"sig":"MEUCIG7Kh81AyzzmCS09xUuqB7PKtuoU4CqqJ1g92MFytf/0AiEA6rjpXKLeK7OWzX6Cq1njpPdSxGZ99yDP2EX3+mPyOW0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":117522},"main":"lib/index.js","module":"lib/index.es.js","gitHead":"d8d0fb8bf29b144eaf025d3a290c23ee5870aba2","private":false,"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","build":"rollup -c && tsc"},"typings":"lib/index.d.ts","_npmUser":{"name":"amna0125","email":"amnaasaeed14@gmail.com"},"repository":{"url":"git+https://github.com/amna1408/usermaven-js.git","type":"git","directory":"packages/react"},"_npmVersion":"10.7.0","description":"Usermaven JavaScript SDK for React","directories":{"lib":"lib"},"_nodeVersion":"20.15.0","dependencies":{"@amna1408/sdk-js":"^1.2.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"17.0.2","rollup":"^2.70.1","@types/react":"17.0.43","react-router":"6.2.2","@rollup/plugin-commonjs":"^21.0.2","@rollup/plugin-typescript":"^8.3.1","@rollup/plugin-node-resolve":"^13.1.4","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"react":"15.x || 16.x || 17.x || 18.x","react-router":"5.x || 6.x"},"_npmOperationalInternal":{"tmp":"tmp/react_1.4.20_1719573443857_0.27458605157680593","host":"s3://npm-registry-packages"}},"1.4.21":{"name":"@amna1408/react","version":"1.4.21","author":{"name":"amna","email":"hello@usermaven.com"},"license":"MIT","_id":"@amna1408/react@1.4.21","homepage":"https://github.com/amna1408/usermaven-js#readme","bugs":{"url":"https://github.com/amna1408/usermaven-js/issues"},"dist":{"shasum":"5f157113543fe86c21541f97c0c0260a0aac8f02","tarball":"https://registry.npmjs.org/@amna1408/react/-/react-1.4.21.tgz","fileCount":15,"integrity":"sha512-U0TTA4B4ZvcunwzBAJix7v/L4kTkqlP+iH10PNaO1cmWCbco4yrOIUFW8WGyG8X5MC4gQL8RNS7NfT6ujTIYTQ==","signatures":[{"sig":"MEQCIAZcOrtRBx49ePXj08Rp2oDh5OMPshoe1eboekfD2K9yAiBTHNCAP/qV8O+PgX7Yw3nl99KWDEJf8ROXIbWTOlZYIw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":117522},"main":"lib/index.js","module":"lib/index.es.js","gitHead":"f6a1f79c3c59b2c10aaba6606ac8c74bdb56ab6d","private":false,"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","build":"rollup -c && tsc"},"typings":"lib/index.d.ts","_npmUser":{"name":"amna0125","email":"amnaasaeed14@gmail.com"},"repository":{"url":"git+https://github.com/amna1408/usermaven-js.git","type":"git","directory":"packages/react"},"_npmVersion":"10.7.0","description":"Usermaven JavaScript SDK for React","directories":{"lib":"lib"},"_nodeVersion":"20.15.0","dependencies":{"@amna1408/sdk-js":"^1.2.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"17.0.2","rollup":"^2.70.1","@types/react":"17.0.43","react-router":"6.2.2","@rollup/plugin-commonjs":"^21.0.2","@rollup/plugin-typescript":"^8.3.1","@rollup/plugin-node-resolve":"^13.1.4","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"react":"15.x || 16.x || 17.x || 18.x","react-router":"5.x || 6.x"},"_npmOperationalInternal":{"tmp":"tmp/react_1.4.21_1719573661096_0.2647486139522739","host":"s3://npm-registry-packages"}},"1.4.22":{"name":"@amna1408/react","version":"1.4.22","author":{"name":"amna","email":"hello@usermaven.com"},"license":"MIT","_id":"@amna1408/react@1.4.22","homepage":"https://github.com/amna1408/usermaven-js#readme","bugs":{"url":"https://github.com/amna1408/usermaven-js/issues"},"dist":{"shasum":"ad2ab12fc57b5a32adcbe5e80cf21d4c61a3a9d2","tarball":"https://registry.npmjs.org/@amna1408/react/-/react-1.4.22.tgz","fileCount":15,"integrity":"sha512-SbqSgDSNHg1cNIt4vhtzmmneVQ5elcGZnTILPfoV88Jug2C3d7zCyvnUOdC1X+AQGUdYi/aVLm8mxhf57zLtDQ==","signatures":[{"sig":"MEUCIQD7YAKJPkQ1S+Bg7I0zs+mfMu8UukuwOxA3pn6cQ449CwIgfpIwyP6JYCl+8hBGz4/qhI0Gqmr3ggtVyVeLNTRGwl4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":117522},"main":"lib/index.js","module":"lib/index.es.js","gitHead":"e38a1d47b684e495c9c79e6e3df5ad1abfc45af0","private":false,"scripts":{"test":"echo \"Error: run tests from root\" && exit 1","build":"rollup -c && tsc"},"typings":"lib/index.d.ts","_npmUser":{"name":"amna0125","email":"amnaasaeed14@gmail.com"},"repository":{"url":"git+https://github.com/amna1408/usermaven-js.git","type":"git","directory":"packages/react"},"_npmVersion":"10.7.0","description":"Usermaven JavaScript SDK for React","directories":{"lib":"lib"},"_nodeVersion":"20.15.0","dependencies":{"@amna1408/sdk-js":"^1.2.5"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"17.0.2","rollup":"^2.70.1","@types/react":"17.0.43","react-router":"6.2.2","@rollup/plugin-commonjs":"^21.0.2","@rollup/plugin-typescript":"^8.3.1","@rollup/plugin-node-resolve":"^13.1.4","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"react":"15.x || 16.x || 17.x || 18.x","react-router":"5.x || 6.x"},"_npmOperationalInternal":{"tmp":"tmp/react_1.4.22_1719574329935_0.11220346193514819","host":"s3://npm-registry-packages"}},"1.5.0":{"name":"@amna1408/react","version":"1.5.0","description":"Usermaven JavaScript SDK for React","author":{"name":"amna","email":"hello@usermaven.com"},"license":"MIT","main":"lib/index.js","typings":"lib/index.d.ts","module":"lib/index.es.js","private":false,"directories":{"lib":"lib"},"publishConfig":{"access":"public"},"dependencies":{"@amna1408/sdk-js":"^1.2.5"},"peerDependencies":{"react":"15.x || 16.x || 17.x || 18.x","react-router":"5.x || 6.x"},"devDependencies":{"@rollup/plugin-commonjs":"^21.0.2","@rollup/plugin-node-resolve":"^13.1.4","@rollup/plugin-typescript":"^8.3.1","@types/react":"17.0.43","react":"17.0.2","react-router":"6.2.2","rollup":"^2.70.1","rollup-plugin-peer-deps-external":"^2.2.4"},"scripts":{"build":"rollup -c && tsc","test":"echo \"Error: run tests from root\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/amna1408/usermaven-js.git","directory":"packages/react"},"_id":"@amna1408/react@1.5.0","gitHead":"7e5ca9145af2c5433a7b1a39ded52aa0dbbb0bed","bugs":{"url":"https://github.com/amna1408/usermaven-js/issues"},"homepage":"https://github.com/amna1408/usermaven-js#readme","_nodeVersion":"20.15.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-Z1Bm2WIaXTsgMm+ioAQr+wamM7fo/GOL/1xZMq99sZn8y6gKHCGZra+zwixkC2zso2BV9t8a1gf9qERPCmPoKQ==","shasum":"f6e99e22f36d50277f0a297a765de1bc58e087a6","tarball":"https://registry.npmjs.org/@amna1408/react/-/react-1.5.0.tgz","fileCount":15,"unpackedSize":117521,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBK/TI6BqUziMUy6359dgVts+9pSN6xN2u5a0IsZG2ZGAiEA5VCNrNQtccvqgJOYL0qg4LrrnQt+5UPvlYWt7VB8rvM="}]},"_npmUser":{"name":"amna0125","email":"amnaasaeed14@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react_1.5.0_1719576263271_0.8794315743823318"},"_hasShrinkwrap":false}},"time":{"created":"2024-06-24T11:47:25.801Z","modified":"2024-06-28T12:04:23.641Z","1.4.18":"2024-06-24T11:47:26.059Z","1.4.19":"2024-06-24T11:54:42.980Z","1.4.20":"2024-06-28T11:17:23.979Z","1.4.21":"2024-06-28T11:21:01.270Z","1.4.22":"2024-06-28T11:32:10.083Z","1.5.0":"2024-06-28T12:04:23.447Z"},"maintainers":[{"name":"amna0125","email":"amnaasaeed14@gmail.com"}],"author":{"name":"amna","email":"hello@usermaven.com"},"repository":{"type":"git","url":"git+https://github.com/amna1408/usermaven-js.git","directory":"packages/react"},"license":"MIT","homepage":"https://github.com/amna1408/usermaven-js#readme","bugs":{"url":"https://github.com/amna1408/usermaven-js/issues"},"readme":"# Official Usermaven SDK for React\n\n\n## General\n\nThis package is a wrapper around `@usermaven/sdk-js`, with added functionality related to React.\n\n## Installation\n\nTo use Usermaven SDK, install npm package\n\n```bash\nnpm install @usermaven/react\n```\n\nImport and configure Usermaven SDK Provider\n\n```typescript jsx\n//...\nimport { createClient, UsermavenProvider } from \"@usermaven/react\";\n\n// initialize Usermaven client\nconst usermavenClient = createClient({\n  tracking_host: \"__USERMAVEN_HOST__\",\n  key: \"__API_KET__\",\n  // See Usermaven SDK parameters section for more options\n});\n\n// wrap our app with Usermaven provider\nReactDOM.render(\n  <React.StrictMode>\n    <UsermavenProvider client={usermavenClient}>\n      <App />\n    </UsermavenProvider>\n  </React.StrictMode>,\n  document.getElementById('root')\n);\n```\nSee [parameters list](https://usermaven.com/docs/sending-data/js-sdk/parameters-reference) for `createClient()` call.\n\n## Usage\n\n```typescript jsx\nimport { useUsermaven } from \"@usermaven/react\";\n\nconst App = () => {\n  const {id, track, trackPageView} = useUsermaven(); // import methods from useUsermaven hook\n\n  useEffect(() => {\n    id({id: '__USER_ID__', email: '__USER_EMAIL__'}); // identify current user for all track events\n    trackPageView() // send page_view event\n  }, [])\n  \n  const onClick = (btnName: string) => {\n    track('btn_click', {btn: btnName}); // send btn_click event with button name payload on click\n  }\n  \n  return (\n    <button onClick=\"() => onClick('test_btn')\">Test button</button>\n  )\n}\n```\n\\\nTo enable automatic pageview tracking, add `usePageView()` hook. This hook will send pageview each time\nuser loads a new page (including internal SPA pages). This hook relies on [React Router](https://reactrouter.com/) and\nrequires `react-router` (>=5.x) package to be present\n```typescript jsx\nconst App = () => {\n  usePageView() //this hook will send pageview track event on router change\n\n  return (\n    <Routes>\n      <Route path=\"/\" element={<Main />} />\n      <Route path=\"page\" element={<Page />} />\n    </Routes>\n  );\n}\n```\n\\\nIf you need to pre-configure usermaven event - for example, identify a user, it's possible to do via `before` callback:\n```typescript\nusePageView({before: (usermaven) => usermaven.id({id: '__USER_ID__', email: '__USER_EMAIL__'})})\n```\n\n## Hooks\n\n### useUsermaven\n\nReturns object with `id`, `track`, `trackPageView`, `rawTrack`, `set`, `unset` and `interceptAnalytics` [methods of Usermaven SDK](https://usermaven.com/docs/sending-data/js-sdk/methods-reference).\n\n### usePageView\n\nCan be used only with react-router. Sends `pageview` event on every route change.","readmeFilename":"README.md"}