If you are using Next.js (version 9.5+), you can bypass ad-blockers by using the rewrite functionality!
next.config.js
Add following rewrite rules into the file:
async rewrites() {
return [
{
source: "/bee.js",
destination: "<https://cdn.splitbee.io/sb.js>",
},
{
source: "/_hive/:slug",
destination: "<https://hive.splitbee.io/:slug>",
},
];
},
You will need to adapt the script tag to reflect the changes and use your own proxy.
<script async data-api="/_hive" src="/bee.js"></script>
data-api
sets the endpoint for all tracking calls. We are using /_hive
in this example.
src
needs to point to the Splitbee JS file that is proxied through your servers. We are using /bee.js
in this example.
Feel free to adapt those paths & filenames.