Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swetrix/swetrix-nextjs
Swetrix Tracking integration for Next.js
https://github.com/swetrix/swetrix-nextjs
analytics nextjs privacy selfhosted tracking web-analytics
Last synced: 2 months ago
JSON representation
Swetrix Tracking integration for Next.js
- Host: GitHub
- URL: https://github.com/swetrix/swetrix-nextjs
- Owner: Swetrix
- License: mit
- Created: 2022-05-03T22:13:01.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-03T23:17:57.000Z (almost 3 years ago)
- Last Synced: 2024-11-30T14:47:08.868Z (2 months ago)
- Topics: analytics, nextjs, privacy, selfhosted, tracking, web-analytics
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@swetrix/nextjs
- Size: 8.79 KB
- Stars: 15
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# Swetrix Next.js integration
Official [Swetrix Analytics](https://swetrix.com/?ref=github-swetrix-nextjs) integration for Next.js.# Integration
### Install
Run the following command to install in your project:
```
npm install @swetrix/nextjs
```Or with yarn:
```
yarn add @swetrix/nextjs
```### Basic usage
You can now import, and use the Swetrix hook on your project:
```javascript
// ./pages/_app.jsimport { useSwetrix } from '@swetrix/nextjs'
function YourApp({ Component, pageProps }) {
useSwetrix('YOUR_PROJECT_ID')return
}export default YourApp
```### Debug-mode
When developing in localhost, Swetrix does not send events to avoid using your quota. \
You can enable debug mode to send events when testing things locally. It will also log messages to console.```javascript
// ./pages/_app.jsimport { useSwetrix } from '@swetrix/nextjs'
function YourApp({ Component, pageProps }) {
useSwetrix('YOUR_SITE_ID', {
debug: true
})return
}export default YourApp
```### Advanced options
`useSwetrix` hook accepts 3 parameters: `PID`, `initOptions`, `pageViewsOptions`. \
See our [documentation](https://swetrix.com/docs) page for more details. \
You can always [contact](https://swetrix.com/contact) us in case of any questions! :)# Contribution
Feel free to contribute to the source code by opening a pull requests. \
For any questions, you can open an issue ticket, refer to our [FAQs](https://swetrix.com/#faq) page or reach us at [email protected] \# Selfhosted API
If you are selfhosting the [Swetrix-API](https://github.com/Swetrix/swetrix-api), be sure to point the `apiUrl` parameter to: `https://yourapiinstance.com/log`# Donate
You can support the project by donating us at https://ko-fi.com/andriir \
We can only run our services by once again asking for your financial support!