Install Guide on Azure | AesirX ANALYTICS
How to install AesirX Analytics
Server Setup
Before installing AesirX analytics, you must have the following installed 1st party server for AesirX Analytics:
1. Clone project from github
git clone https://github.com/aesirxio/analytics-1stparty.git
2. Clone the aesirx-1stparty.env.dist file into aesirx-1stparty.env and customize
2.1 You can choose not to customize anything.
2.2 If you have a separate MongoDB server, you can specify the credentials using the following variables:
- DBUSER
- DBPASS
- DBHOST
- DBPORT
- DBNAME
2.3 You can choose to change the HTTP_PORT variable (default 80), which is the port that your 1st party server will listen to.
3. Execute docker compose up -d to run the full setup, including the MongoDB server.
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 the REACT_APP_CLIENT_SECRET and REACT_APP_LICENSE in your profile.
If you don't have any license, select one from our homepage.
4. Enter domain and test domain of license. For example:
5. Install package in your NextJS App.
npm i aesirx-analytics
6. Replace the NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL in the .env file in your NextJS app with the link to your 1st party server.
7. Using with next/router in app.js:
import { useRouter } from "next/router";
import { AnalyticsNext } from "aesirx-analytics";
<AnalyticsNext router={useRouter()}>
<[YOUR-COMPONENT]/>
</AnalyticsNext>
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: "<name-1>", value: "<value-1>" },
{ name: "<name-2>", value: "<value-2>" }
],
});
};
return (
<button on-Click={() => {initTrackEvent();}}> Search </button>
);
}