Cloudflare Workers Integration
Inject the tracking snippet dynamically at the edge using Cloudflare Workers.
Edge HTML Rewriter Setup
If you don't have direct access to your site's codebase or template folders, you can inject the script at the Cloudflare edge proxy using a Worker with HTMLRewriter.
Worker Script Example
Below is a sample Cloudflare Worker code template that intercepts responses and appends the script tag in the header:
javascript
export default {
async fetch(request, env, ctx) {
const response = await fetch(request);
// Only rewrite HTML pages
const contentType = response.headers.get("content-type") || "";
if (!contentType.includes("text/html")) {
return response;
}
const trackerScript = '<script src="https://aiready.co/t.js?id=YOUR_SITE_ID" async></script>';
return new HTMLRewriter()
.on("head", {
element(element) {
element.append(trackerScript, { html: true });
},
})
.transform(response);
},
};Still having trouble with integration?
Reach out to our developer support team directly. We are happy to help get you verified.