Installation

npm install -S analytica.click

How to use

Wrap your top level component with the AnalyticaClickProvider

import { AnalyticaClickProvider } from 'analytica.click';<AnalyticaClickProvider values={{ analyticaToken: 'your api token' }} > <Your Components....> </AnalyticaClickProvider>

Example of automatic page tracking

import { useAnalytica } from 'analytica.click'; ... let lastLocation=''; ... YourComponent(){ const { page } = useAnalytica(); useEffect(() => { if (<current path name> !== lastLocation) { // will use window location page({}); lastLocation = <current path name>; } }, [page, <current path name>]); ... }

Example of event tracking

import { useAnalytica } from 'analytica.click'; ... const { event } = useAnalytica(); event({ eventName: 'my event name' });

Example of integrating analytica.click with your github build pipeline

- name: notify analytica of build if: always() uses: andreigecanalytica/analytica.click.gh@v2 with: ANALYTICA_TOKEN: '${{ secrets.ANALYTICA_TOKEN }}'

Set the token to your project Admin Api Key. Server-side requests authenticated with the Admin Api Key bypass bot filtering; the regular Api Key is treated as client traffic and can be dropped as a bot.

Privacy PolicyTerms of ServiceContact UsDocumentation
© 2024 analytica.click