Welcome to My Site!
This site is all about analytics and tracking data for your website. With our tools, you can easily see how your site is performing, and make data-driven decisions to improve your online presence.
To get started, sign up for an account or log in to your existing account.
How to use Analytics Benson in your React app
- Install the package: npm install analytics-benson
- Import the
analytics
function from the package:
import analytics from 'analytics-benson'; - Call the analytics function, passing in your siteName and clientId:
analytics('Your Site Name', 'your-client-id'); - Place the function call in a suitable location in your app, such as in the root component or a layout component. For example you can use the useEffect hook to call the function when the component first loads:
import React, {useEffect} from 'react'; import './App.css'; import analytics from 'analytics-benson'; function App() { const CLIENT_ID = 'this-is-an-example-client-id' useEffect(() => { analytics('Hello World App', CLIENT_ID); }, []); return ( <div className="App"> <h1> Hello World! </h1> </div> ); } export default App;
Note: The function will run once per hour unless the user is not keeping localStorage. A timestamp is placed in localStorage to check if the user has used the app in the past hour.
How to use Analytics Benson with a CDN
If you prefer to use a CDN instead of installing the package, add the following script tags to your HTML file, replacing 'yourSiteName' and 'yourClientId' with the appropriate values:
<script src="https://cdn.jsdelivr.net/npm/analytics-benson@1.1.0/analytics.min.js"></script> <script> analytics('yourSite Name', 'your-Client-Id'); </script>
Note: The function will run once per hour unless the user is not keeping localStorage. A timestamp is placed in localStorage to check if the user has used the app in the past hour.