@wisersolutions/heap-analytics
v0.1.1
Published
Utils for integrating HeapAnalytics into web applications.
Downloads
4
Readme
heap-analytics
Utils for integrating Heap into web applications.
Use
To use Heap in a React application, simply use the useHeap
hook in an app root with access
to both the assigned Heap ID and to user information.
import { useHeap } from '@wisersolutions/heap-analytics'
export const App = ({ heapId, username, ...props }) => {
useHeap(heapId, username)
// … (render the app)
}
To integrate Heap into an app that's not using React, import just the loader code.
import '@wisersolutions/heap-analytics/lib/heap'
Development
Install
Install dependencies using:
npm install
Develop
After you modify sources, run the following (or set up your IDE to do it for you):
- format the code using
npm run format
- lint it using
npm run lint
and fix the errors, if there are any.
Publish
Publishing is done in two steps:
- Create a new version tag and push it to the repository:
npm version <patch|minor|major> git push --follow-tags
- Build and publish the new version as a npm package:
npm publish --access public