initial commit
This commit is contained in:
commit
d799808203
126 changed files with 16265 additions and 0 deletions
25
components/analytics/SimpleAnalytics.tsx
Normal file
25
components/analytics/SimpleAnalytics.tsx
Normal file
|
@ -0,0 +1,25 @@
|
|||
import Script from 'next/script'
|
||||
|
||||
const SimpleAnalyticsScript = () => {
|
||||
return (
|
||||
<>
|
||||
<Script strategy="lazyOnload" id="sa-script">
|
||||
{`
|
||||
window.sa_event=window.sa_event||function(){var a=[].slice.call(arguments);window.sa_event.q?window.sa_event.q.push(a):window.sa_event.q=[a]};
|
||||
`}
|
||||
</Script>
|
||||
<Script strategy="lazyOnload" src="https://scripts.simpleanalyticscdn.com/latest.js" />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
// https://docs.simpleanalytics.com/events
|
||||
export const logEvent = (eventName, callback) => {
|
||||
if (callback) {
|
||||
return window.sa_event?.(eventName, callback)
|
||||
} else {
|
||||
return window.sa_event?.(eventName)
|
||||
}
|
||||
}
|
||||
|
||||
export default SimpleAnalyticsScript
|
Loading…
Add table
Add a link
Reference in a new issue