Next JS Proxy

You can use Next.js to route all analytics traffic through your own server and domain. This will reduce DNS lookups, as well as prevent Adblockers from blocking requests.

By default the tracker sends request to loglib api so change that on that by passing "/api/loglib" to the config host paramter.

import { loglib } from "@loglib/tracker"; loglib.record({ host: "/api/loglib", });

Then add a rewrite to your Next.js config.

module.exports = { async rewrites() { return [ { source: "/api/loglib", destination: "https://loglib.io/api/loglib", }, ]; }, };