Guides
Remix
Integrate Alytica with your Remix application.
Create app/components/AlyticaProvider.tsx
:
import { useState, useEffect } from 'react';
import { Alytica } from 'alytica-js';
export function AlyticaProvider({ children }) {
const [alytica, setAlytica] = useState(null);
useEffect(() => {
const alyticaInstance = new Alytica({
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
trackPageViews: true
});
setAlytica(alyticaInstance);
}, []);
return (
<AlyticaContext.Provider value={alytica}>
{children}
</AlyticaContext.Provider>
);
}
In app/root.tsx
:
import { AlyticaProvider } from './components/AlyticaProvider';
export default function App() {
return (
<html>
<body>
<AlyticaProvider>
{/* Your app content */}
</AlyticaProvider>
</body>
</html>
);
}
- Replace
'your-client-id'
and 'your-client-secret'
with your actual Alytica credentials
- Configure tracking options based on your specific requirements
- Ensure compliance with privacy regulations when tracking user data