Preact Analytics
With minimal adjustments, you can seamlessly integrate Proxima Analytics into your Preact application. The process of adding the Proxima Analytics Script to your Preact application is similar to that of React, making it a straightforward task to accomplish.
Getting Started
To begin integrating Proxima Analytics into your Preact application, the first step is to install the Proxima Client package.
npm install @prxm/client
Once it's installed, you can then create a simple component that utilizes the client library to initialize Proxima Analytics and start monitoring pageviews in your application.
import * as client from '@prxm/client';
import { useEffect } from 'preact/hooks';
const Proxima = () => {
useEffect(() => {
client.init({ site: 'YOUR_WEBSITE_ID' });
}, []);
return null;
};
export default Proxima;
Finally include this component in your application's root component:
src/App.tsx
import Proxima from './components/proxima';
const App = () => {
return (
<div>
<Proxima />
<h1>Hello, world!</h1>
</div>
);
};