Every other path under
/or/ returns 404.
Why use it
- Ad blockers. Many blocklists match requests to analytics domains. Requests to your own domain at
/or/are not on those lists, so fewer pageviews go missing. - Correct visitor location. Without a key, OpenRevenue would see your server’s address instead of your visitor’s. The proxy sends a key, the visitor’s address and, where your platform provides it, the visitor’s location. OpenRevenue uses them only when the key is valid for the project.
How it works
- The browser loads
/or/s.jsfrom your site. Your proxy fetches it from OpenRevenue. - The tracker sees that it was loaded from
/or/s.jsand sends events to/or/enext to it, on your domain. - Your proxy forwards each event to OpenRevenue with your proxy key and the visitor’s address and location.
- OpenRevenue checks the key. If it’s valid for the project, it records the forwarded address and location. If it isn’t, the event is still counted, but without the visitor’s address and location. All visitors then share your server’s address, so on a busy site per-address rate limits can start dropping events: keep the key valid.
Set it up
1
Create a proxy key
Open
Settings → Proxy for your project and click Create proxy key. Copy the key: it starts with orpx_ and is shown only once. OpenRevenue stores only a hash of it.Only project owners and admins can create, rotate or remove keys.2
Add the proxy to your site
Pick the recipe for your platform below and paste it as-is. Store the key on the server only. It must never appear in your HTML or JavaScript.
3
Change the script tag
Load the tracker from your own domain:Replace
your-project-id with the project ID from Settings → General. You don’t need any other attribute: events go to /or/e automatically.4
Check the setup
In
Settings → Proxy, under Check proxy, enter your proxy address (for example https://example.com/or) and click Check. OpenRevenue loads /or/s.js and calls /or/check through your proxy, then shows whether the key is valid and whether the visitor’s address and location arrive. No event is recorded. See Check the proxy.Recipes
Each recipe is one file with no dependencies. They forward only the browser headers OpenRevenue needs (see What the proxy forwards).- Next.js
- Cloudflare Worker
- nginx
For the App Router in Next.js 15 and 16, on Vercel or any other host. Save the file as
app/or/[...path]/route.ts (or src/app/or/[...path]/route.ts if you use a src folder).Set OPENREVENUE_PROXY_KEY in your server environment, for example in your Vercel project settings. Don’t prefix it with NEXT_PUBLIC_: that would publish it in your JavaScript.app/or/[...path]/route.ts
- Visitor address: the first entry of
x-forwarded-for, orx-real-ip, as your host sets them. - Location: on Vercel, from Vercel’s
x-vercel-ip-*headers. On other hosts, events are recorded without a location. - Caching: the script is cached for an hour. Events and checks are never cached.
- Self-hosted OpenRevenue: set
OPENREVENUE_COLLECTOR_ORIGINto your OpenRevenue address.
Check the proxy
Check proxy inSettings → Proxy runs this check for you. You can also call it yourself:
If
key is invalid, check that the environment variable or placeholder holds the full key and that you redeployed after changing it.
Rotate or remove the key
- Rotate:
Settings → Proxy→ Rotate key creates a new key. The old key keeps working for 24 hours, so you have time to deploy the new one. - Rotate and revoke: the old key stops working immediately. Use this if the key leaked.
- Remove: every key for the project stops working.
What the proxy forwards
To OpenRevenue, the proxy sends:- The event body, unchanged.
- These browser headers, unchanged:
Content-Type,User-Agent,Accept-Language,Origin,Referer,Sec-Fetch-Site,Sec-Fetch-Mode,Sec-Fetch-DestandSec-GPC. - Your proxy key, the visitor’s address, the visitor’s location if your platform knows it, and the recipe name.
Authorization headers or any other request header.
Back to the browser, the proxy returns only the status, the body, Content-Type and Cache-Control. It never passes on Set-Cookie.
Limits
- Without a valid key, OpenRevenue can’t trust the forwarded address, so it records your server’s address and no location.
- nginx without Cloudflare in front, and Next.js outside Vercel, can’t send a location. Events are counted without one.
- The proxy must be on the same site as your pages. OpenRevenue still checks the
Originof each event against your project’s allowed hostnames. - If you use a different path than
/or/, change it in the recipe and in the scriptsrc. The tracker always sends events toenext to the script, for example/stats/efor/stats/s.js. To send events somewhere else, setdata-apion the script tag to the full event URL.