Search code examples
next.jscloudflare

How to load Zaraz manually in Nextjs


i am trying to get the Zaraz Script working on a Nextjs Site which can not use the cloudflare proxy (orange) setting. Following the documentation https://developers.cloudflare.com/zaraz/advanced/load-zaraz-manually I disabled auto injection and added the script in _app.js:

import Script from 'next/script'
return <Script src="https://capsloq.de/cdn-cgi/zaraz/i.js"></Script>

The <script> Tag is rendered within the <head> of the website. But the <script src> just points to a 404 Page, not actually loading the script. Is Nextjs Page Router interfering with it? Or am I missing a basic thing?

Thank you


Solution

  • It seems that the domain https://capsloq.de is not proxied by Cloudflare. Check the docs at this link https://developers.cloudflare.com/zaraz/advanced/domains-not-proxied.