An Eventvisor v1 project which builds, tests, and deploys a web Target to Cloudflare Pages.
Use this repository as a reference for hosting generated Eventvisor datafiles on your own Cloudflare Pages project.
The generated web datafile from this repository is available at:
The web Target selects definitions tagged with web. Eventvisor v1 generates datafiles for Targets rather than tags, so the output is eventvisor-web.json.
Install the v1 SDK and the Console module in your application:
npm install @eventvisor/sdk@1 @eventvisor/module-console@1Load the deployed datafile and create an Eventvisor instance:
import { createEventvisor } from "@eventvisor/sdk";
import { createConsoleModule } from "@eventvisor/module-console";
const DATAFILE_URL =
"https://eventvisor-example-cloudflare.pages.dev/eventvisor-web.json";
const datafileContent = await fetch(DATAFILE_URL).then((res) => res.json());
const eventvisor = createEventvisor({
datafile: datafileContent,
modules: [createConsoleModule()],
});
await eventvisor.onReady();
await eventvisor.track("page_view", {
url: window.location.href,
});Learn more in the JavaScript SDK documentation.
This project uses Node.js 24 and Eventvisor CLI v1. Install its locked dependencies with:
npm cinpm run lintnpm run buildThe build writes datafiles/eventvisor-web.json.
npm testTests cover the page_view event schema and its transformed body for the browser destination.
The publish workflow builds the project and uploads the datafiles directory to Cloudflare Pages.
Create a Cloudflare Pages project named eventvisor-example-cloudflare, or update the project name in the publish workflow.
GitHub Actions lint, test, and build every change. Pushes to the default branch also deploy the generated datafile and commit the updated Eventvisor revision.
You can use the same commands with any other CI provider.
Enable Read and write permissions under Settings > Actions > General > Workflow permissions so the publish workflow can commit the updated revision.
The workflows live in .github/workflows:
checks.ymlvalidates branches before merging.publish.ymlvalidates and deploys pushes tomainormaster.
Follow Cloudflare's direct upload guide and add these repository secrets under Settings > Secrets and variables > Actions:
CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_API_TOKEN