fix sdk api

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-05 21:14:38 +01:00
parent 95408918ab
commit 5f873898e9
16 changed files with 343 additions and 251 deletions

View File

@@ -1,14 +1,14 @@
import { MixanWeb } from '@mixan-test/sdk-web';
// import { MixanWeb } from '@mixan-test/sdk-web';
export const mixan = new MixanWeb({
verbose: true,
url: 'http://localhost:3000/api/sdk',
clientId: '568b4ed1-5d00-4f27-88a7-b8959e6674bd',
clientSecret: '1e362905-d352-44c4-9263-e037a2ad52fb',
trackIp: true,
});
// export const mixan = new MixanWeb({
// verbose: true,
// url: 'http://localhost:3000/api/sdk',
// clientId: '568b4ed1-5d00-4f27-88a7-b8959e6674bd',
// clientSecret: '1e362905-d352-44c4-9263-e037a2ad52fb',
// trackIp: true,
// });
mixan.init({
appVersion: '1.0.0',
});
mixan.trackOutgoingLinks();
// mixan.init({
// appVersion: '1.0.0',
// });
// mixan.trackOutgoingLinks();

View File

@@ -1,15 +1,15 @@
import { useEffect } from 'react';
import { mixan } from '@/analytics';
// import { mixan } from '@/analytics';
import type { AppProps } from 'next/app';
import { useRouter } from 'next/router';
export default function MyApp({ Component, pageProps }: AppProps) {
const router = useRouter();
useEffect(() => {
mixan.screenView();
return router.events.on('routeChangeComplete', () => {
mixan.screenView();
});
}, []);
// useEffect(() => {
// mixan.screenView();
// return router.events.on('routeChangeComplete', () => {
// mixan.screenView();
// });
// }, []);
return <Component {...pageProps} />;
}

View File

@@ -0,0 +1,21 @@
import { Head, Html, Main, NextScript } from 'next/document';
export default function Document() {
return (
<Html>
<Head>
<script
async
src="/cdn.global.js"
client-id="568b4ed1-5d00-4f27-88a7-b8959e6674bd"
client-secret="1e362905-d352-44c4-9263-e037a2ad52fb"
track-screen-views="true"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}