Documentation Index
Fetch the complete documentation index at: https://docs.postmetric.io/llms.txt
Use this file to discover all available pages before exploring further.
Proxy PostMetric through your own domain to improve privacy, avoid ad blockers, and maintain control over your analytics.
Why use a proxy?
- Privacy - All requests go through your domain
- Ad blocker resistance - Requests appear to come from your domain
- Control - Full control over request routing
- Performance - Can cache requests if needed
How it works
Instead of loading the tracking script from PostMetric’s domain:
<!-- Direct (not proxied) -->
<script src="https://analytics.example.com/api/track.js?site=CODE"></script>
You proxy it through your domain:
<!-- Proxied -->
<script src="https://your-domain.com/api/track.js?site=CODE"></script>
Your server forwards the request to PostMetric and returns the response.
Setup methods
Next.js
Proxy with Next.js
Express.js
Proxy with Express.js
Basic proxy example
Here’s a simple proxy implementation:
// Proxy /api/track.js to PostMetric
app.get("/api/track.js", async (req, res) => {
const response = await fetch(
`https://your-postmetric-domain.com/api/track.js?${
req.url.split("?")[1]
}`
);
const script = await response.text();
res.setHeader("Content-Type", "application/javascript");
res.send(script);
});
Update tracking script URL
After setting up the proxy, update your tracking script URL to use your domain:
<script src="https://your-domain.com/api/track.js?site=YOUR_TRACKING_CODE"></script>
Next steps
Choose your platform to see detailed setup instructions.