How to install AesirX Analytics
Step-by-step guide:
1. Register your account at https://analytics.aesirx.io/. You will then get an email for user creation account.
2. Activate your account by clicking verify in the email
3. Login to https://analytics.aesirx.io/ site to get your LICENSE in your profile.
4. Install package in your NextJS App.
npm i aesirx-analytics
5. Replace the NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL in the .env file in your NextJS app with the link to your 1st party server.
6. Using with next/router in app.js:
import { useRouter } from "next/router";
import { AnalyticsNext } from "aesirx-analytics";
<[YOUR-COMPONENT]/>
Track events:
import { trackEvent, AnalyticsContext } from "aesirx-analytics";
const CustomEvent = () => {
const AnalyticsStore = useContext(AnalyticsContext);
const initTrackEvent = async () => {
await trackEvent(endPoint, AnalyticsStore.event_uuid, AnalyticsStore.visitor_uuid, referrer,
{
event_name: "Submit",
event_type: "submit",
attributes: [
{ name: "", value: "" },
{ name: "", value: "" }
],
});
};
return (
);
}
Share