Skip to content

Commit

Permalink
feat: added smartlook
Browse files Browse the repository at this point in the history
  • Loading branch information
netlob committed Jan 25, 2024
1 parent 3dc2584 commit 073e576
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import localFont from '@next/font/local';
import clsx from 'clsx';
import ErrorBoundary from '@/components/ErrorBoundary';

import Script from 'next/script';

// TODO: this is the stupidest solution to the worst issue ever, works for now
// https://github.com/tailwindlabs/headlessui/discussions/666#discussioncomment-1891380
if (typeof window !== 'undefined') {
Expand Down Expand Up @@ -60,6 +62,21 @@ const Ogp = () => (
</>
);

const Smartlook = () => {
return (
<>
<Script id="smartlook-tag">
{` window.smartlook || (function(d) {
var o=smartlook=function(){ o.api.push(arguments)},h=d.getElementsByTagName('head')[0];
var c=d.createElement('script');o.api=new Array();c.async=true;c.type='text/javascript';
c.charset='utf-8';c.src='https://web-sdk.smartlook.com/recorder.js';h.appendChild(c);
})(document);
smartlook('init', '6262fc1ab5badfb59df569ba2daf04f562017bfd', { region: 'eu' });`}
</Script>
</>
);
};

// TODO: we'll probably rewrite the auth logic to use a state management store instead of context, but we implemented this temporary for development
const App = ({
Component,
Expand All @@ -84,6 +101,7 @@ const App = ({
<meta property="og:type" content="website" />
<meta property="twitter:site" content="@spotistats" />
<meta property="twitter:creator" content="@spotistats" />
<Smartlook />
{showOgp && <Ogp />}
</Head>
<ToasterContainer>
Expand Down

0 comments on commit 073e576

Please sign in to comment.