@mejik.dev/mg-react-analytics
v0.0.4-alpha
Published
[![N|Solid](https://microgen.id/static/images/logo.svg)](#)
Downloads
2
Readme
Microgen react analytics
send analytics from client side microgen API
currently only supported with React Apllo
Setup
import { ApolloClient, InMemoryCache, HttpLink, from } from "@apollo/client";
import analytics from "@mejik.dev/mg-react-analytics";
const { slowResponseTimeLink } = analytics("your project path");
// report when there's query respone time greater than 5000 ms
const slowResponseLink = slowResponseTimeLink(5000);
const httpLink = new HttpLink({
uri: "http://localhost:4000/graphql",
});
const client = new ApolloClient({
link: from([slowResponseLink, httpLink]),
cache: new InMemoryCache(),
});