@qlibs/react-components
v2.45.4
Published
``` const {insertData} = useTrackData(); const location = useLocation()
Downloads
210
Readme
TRACK ME
How to use TrackMe
const {insertData} = useTrackData();
const location = useLocation()
<TrackMe
appName='QLIBS'
userId='QLIBS_userId'
userData={{name: 'QLIBS_user_name'}}
processUpload={(
activities: IActivity[],
onSuccess: (ids: number[]) => void
) => {
console.info('before onSuccess activities', activities);
onSuccess(activities.map(item => (item as any).activityId));
}}
location={location}
autoUploadConfig={{
intervalInMs: 5000,
}}
isDemo={true}
/>
useTrackerIndexedDB({
appName: "PROJECT_NAME",
userId: user.userId,
userData: user,
processUpload: (activities: IActivity[], onSuccess: (ids: number[]) => void) => {
httpRequest
.post(process.env.REACT_APP_API_URL_TRACKME || '', { bulk: activities })
.then((res: any) => {
onSuccess((res.data.payload || []).map((item: any) => item.activityId));
})
.catch((err) => {
message.error(getErrorMessage(err));
});
},
});
How to don't track me
<button data-trackme="false">WILL NOT TRACKED</button>